房天下 > 房天下问答 > 业主生活 > 其他
  • JAVA改错题

    interface Xx{ int K; int tt();}interface Yy { long mm();}class Zz { float nn(){ return 40; }}public class Test extends Zz implements Xx,Yy{ public static void main(String[] args){ Test tst=new Test(); System.out.println(tst.K+tst.tt()+tst.mm()+tst.nn()); }}怎么修改可以调试成功???

    提问者:唐星星

    发布于2011-01-18

共1个回答
  • 我叫三好 丨Lv 4
    interface Xx{ 【接口1】int K; int tt(); } interface Yy { 【接口2】long mm(); } class Zz { float nn(){ return 40; } } public class Test extends Zz implements Xx,Yy{ public static void main(String[] args){ Test tst=new Test(); System.out.println(tst.K+tst.tt()+tst.mm()+tst.nn()); } } 黑色标示都是接口,接口只有实现,不能在其他函数里面调用接口里面的任何函数,数据类型,你把接口换成其他int,byte ..等公共类型的类就可以了
    +1 2011-01-18 举报
热门人气推荐
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。