package test;
public class Father {
private String name;
class Child{
public void introFather(){
System.out.println(name);
}
}
public Child newChild(){
return new Child();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package test;
import test.Father.Child;
public class Test {
public static void main(String[] args) {
Father father= new Father();
father.setName("zhangjun0");
Child child=father.newChild();
child.introFather();
}
}
public class Father {
private String name="zhangjun0";
class Child {
public void introFather(){
System.out.println(name);
}
}
}
---------------------------------
public class Test {
public static void main(String[] args) {
Father.Child child=new Father().new Child();
child.introFather();
}
}