当前位置: 技术问答>java相关
Think in java 问题。(请教)
来源: 互联网 发布时间:2015-05-30
本文导语: 从第八章起就看得我头昏脑胀,不知为何不能编译: 请教!请教!请教!(jdk1.1.5) //: c08:Parcel8.java // From 'Thinking in Java, 2nd ed.' by Bruce Eckel // www.BruceEckel.com. See copyright notice in CopyRight.txt. // An anonymous inner c...
从第八章起就看得我头昏脑胀,不知为何不能编译:
请教!请教!请教!(jdk1.1.5)
//: c08:Parcel8.java
// From 'Thinking in Java, 2nd ed.' by Bruce Eckel
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
// An anonymous inner class that performs
// initialization. A briefer version
// of Parcel5.java.
public class Parcel8 {
// Argument must be final to use inside
// anonymous inner class:
public Destination dest(final String dest) {
return new Destination() {
private String label = dest;
public String readLabel() { return label; }
};
}
public static void main(String[] args) {
Parcel8 p = new Parcel8();
Destination d = p.dest("Tanzania");
}
} ///:~
请教!请教!请教!(jdk1.1.5)
//: c08:Parcel8.java
// From 'Thinking in Java, 2nd ed.' by Bruce Eckel
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
// An anonymous inner class that performs
// initialization. A briefer version
// of Parcel5.java.
public class Parcel8 {
// Argument must be final to use inside
// anonymous inner class:
public Destination dest(final String dest) {
return new Destination() {
private String label = dest;
public String readLabel() { return label; }
};
}
public static void main(String[] args) {
Parcel8 p = new Parcel8();
Destination d = p.dest("Tanzania");
}
} ///:~
|
如果定义了看一看是不是在一个包或者包的位置对不对。