您的位置:首页 > 编程语言 > Java开发

复习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 为什么构造函数不可以使用默认的呢,非要写一下,
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: