作者H45 (!H45)
看板java
标题Re: [问题] interface里的attribute const?
时间Thu Apr 12 11:45:28 2007
※ 引述《walm20 (我要买车啦)》之铭言:
: ※ 引述《DavyBlue (ArssertionError)》之铭言:
: : 在interface中
: : 所有method都是抽象方法
: : public abstract
: : 无论有无宣告 编译时都会自动补上
: : 所有类别属性 都是常数
: : public static final
: : 无论有无宣告 编译时都会自动补上
: : 以上
: 在问一个问题
: 课本写说
: interface and abstract class不行建立参考
: 可是後面程式范例
: 有建立interface参考到一个继承这interface的物件(implement这interface的 class)
: 先谢谢大家搂
问题点在於,你了解什麽叫作「建立参考」吗?
是意指建立一个新的实体 istance
new Something();
//where Something is not an interface nor an abstract class
还是指某个 member field 的定义
Otherthing otherthing;
//where Otherthing is an interface or an abstract class
或者是指多型 Polymorphism
Otherthing otherthing = new Something();
// where Something is a class that implements Otherthing, and
// Otherthing is an interface
哪一道?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.205.85