interface Valu { public double getMoney();}interface Protectable { public void beProtected();}abstract class Animal { private String name; abstract void enjoy();}class GoldenMonkey extends Animal implements Valu,Protectable { public double getMoney() { return 10000; } public void beProtected() { System.out.println("live in the room"); } public void enjoy() { System.out.println("高興"); } }public class Valuable { public static ?void ?main(String args[]) { Valu v = new GoldenMonkey(); v.getMoney(); }}寫了一段測(cè)試接口的代碼 ? ? v.getMoney()方法什么都輸出不出來(lái)?這是為什么? ? 不是應(yīng)該輸出class GodenMonkey類中的getMoney方法 返回值為10000才對(duì)嗎?
請(qǐng)幫忙看看這出了什么問(wèn)題?
月亮島Superman
2017-04-09 21:51:05