教育路上
摘要:java定义一个Father类和Child类。以下是我们为大家整理的,相信大家阅读完后肯定有了自己的选择吧。
2023-09-08 09:30冉茂雪
package Father; public class father { private String name="zhangjun"; //内部类 class child{ public void introFather() { Systemoutprintln(name); } } } package Father; import Fatherfatherchild; public class Test1 { public static void main(String[] args) { child child=new father()new child(); childintroFather(); } }
}
package Father;
import Fatherfatherchild;
public class Test1 { //内部类 Test1
public static void main(String[] args) { //成员变量
child child=new father()new child();
childintroFather();
}
}
访客的评论 2023/12/11 06:32
文中描述的是准确的吗,如何报名!