复习Java的基本类
2010-08-01 18:45
267 查看
package pck1;
import java.lang.*;
public class superclass {
public class thesuper{
thesuper(){}
thesuper(String a){
System.out.println(a);
}
public void test(){
System.out.println("this is super class");
}
}
public class thechild extends superclass.thesuper{
thechild(){}
private void test1(){
System.out.println("this is the class class");
}
}
public static void main(String[] args){
System.out.println("this is the begin");
String aa = "this is superclass";
superclass sclass = new superclass();
thesuper super1 = sclass.new thesuper(aa);
thechild child1 = sclass.new thechild();
super1.test();
child1.test1();
child1.test1();
}
}
1 首先是实例化有问题,内部类的实例化,需要首先实例化外部类,这东西想破头也不知道怎么回事
2 为什么构造函数不可以使用默认的呢,非要写一下,
import java.lang.*;
public class superclass {
public class thesuper{
thesuper(){}
thesuper(String a){
System.out.println(a);
}
public void test(){
System.out.println("this is super class");
}
}
public class thechild extends superclass.thesuper{
thechild(){}
private void test1(){
System.out.println("this is the class class");
}
}
public static void main(String[] args){
System.out.println("this is the begin");
String aa = "this is superclass";
superclass sclass = new superclass();
thesuper super1 = sclass.new thesuper(aa);
thechild child1 = sclass.new thechild();
super1.test();
child1.test1();
child1.test1();
}
}
1 首先是实例化有问题,内部类的实例化,需要首先实例化外部类,这东西想破头也不知道怎么回事
2 为什么构造函数不可以使用默认的呢,非要写一下,
相关文章推荐
- java基础复习1--基本数据类型、运算符号、表达式语句与程序结构
- Java复习笔记1【Java的基本运算】
- Java复习第一天---Javascript的基本知识点
- Java多线程复习与巩固(一)--线程基本使用
- Java(1):Java SE疯狂复习基本数据类型、OOP
- Java基础复习:基本数据类型的包装类
- 从0开始学java——JUnit4 复习,其实基本思想还是那些,不过采用了新的注释格式的语法
- 2.Java基础复习---基本类型的包装类
- Java复习(三)基本数据类型
- java基本数据类型复习
- JS基本类型与Java的区别复习
- 黑马程序员--java基础复习之String类StringBuffer及基本数据类型包装类
- Java复习1.基本知识
- 《Java核心技术》复习笔记 - 第三章 Java基本的程序设计结构
- Java复习1-基本数据类型
- Java复习--线程基本概念
- JAVA的八种基本类型 复习笔记
- Java复习第一天_基本数据类型
- Java复习笔记(四)——Java基本类型的类型转换
- java程序员面试复习资料2——[JAVA基本概念]