主题:关于JAVA内部类的问题
关于JAVA内部类的问题
//Test1.java
package c08_homework;
import c08.Destination;
public class Test1 {
public static void main(String[] args) {
}
}
class A {
private class Pde implements Destination{
public String readLabel(){
return new String("aa");
}
}
public Destination dest(String s) {
class PDestination implements Destination { //line 1 为什么这里的类不可以是private ?
private String label;
private PDestination(String whereTo) {
label = whereTo;
}
public String readLabel() { return label; }
}
return new PDestination(s);
}
} ///:~
//Destination.java
package c08;
public interface Destination {
String readLabel();
} ///:~
请大虾指点
//Test1.java
package c08_homework;
import c08.Destination;
public class Test1 {
public static void main(String[] args) {
}
}
class A {
private class Pde implements Destination{
public String readLabel(){
return new String("aa");
}
}
public Destination dest(String s) {
class PDestination implements Destination { //line 1 为什么这里的类不可以是private ?
private String label;
private PDestination(String whereTo) {
label = whereTo;
}
public String readLabel() { return label; }
}
return new PDestination(s);
}
} ///:~
//Destination.java
package c08;
public interface Destination {
String readLabel();
} ///:~
请大虾指点