Topic: 求助请各位大哥指教(..is not abstract and does not override abstract method..) |
Print this page |
1.求助请各位大哥指教(..is not abstract and does not override abstract method..) | Copy to clipboard |
Posted by: jialichao Posted on: 2006-05-01 16:26 package one; interface Add{ public void addNamber(int a,int b); } interface Minus{ public int minusNamber(int a,int b); } class Account implements Add,Minus{ public void addNumber(int a,int b){ int val; val=a+b; System.out.println("a+b= "+val); } public int minusNumber(int a,int b){ int val; val=a-b; System.out.println("a-b= "+val); } } public class Interface_a{ public static void main(String[] args){ Add obj=new Account(); obj.addNamber(10,20); Minus obj1=new Account(); obj1.minusNamber(100,50); } } 这段程序的出错提示如下: Interface_a.java:8: one.Account is not abstract and does not override abstract method addNamber(int,int) in one.Add class Account implements Add,Minus{ 小弟实在是不知道这该怎么改了,望各位大哥指教呀。 |
2.Re:求助请各位大哥指教。 [Re: jialichao] | Copy to clipboard |
Posted by: tomcatexpert Posted on: 2006-05-01 16:37 晕啊,你那个实现接口的Account类要用和接口相同的方法名 in your interface Add and Minus, 将addNamber和minusNamber 换成 addNumber 和 minusNumber |
3.Re:求助请各位大哥指教(..is not abstract and does not override abstract method..) [Re: jialichao] | Copy to clipboard |
Posted by: jialichao Posted on: 2006-05-02 13:08 谢谢大哥,我可能打的时候打错了,呵呵~~ 太粗心了,经过指点才看到,真谢谢你。 |
4.Re:求助请各位大哥指教(..is not abstract and does not override abstract method..) [Re: jialichao] | Copy to clipboard |
Posted by: tomcatexpert Posted on: 2006-05-02 23:39 用eclipse这样的IDE,这样的粗心它会帮你更正的 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |