看完网上的教学视频 试着自己编个小程序 可是编译出错 但是自己又发现不出来哦
求各位达达帮帮手class Computer{
public static int count=0;
String company;
String insteadof;
Computer(String n,String i){
this.company=n;
this.insteadof=i;
}
}interface technologable {
String lessPower();
String sercuryable();
}interface capabilitable{ String operation();
String startup();
}
class Notebook extends Computer implements technologable,capabilitable{
public String parameter;
Notebook(String a,String b,String c){
super(a,b);
this.parameter=c;
}
public String lessPower(String str){
return "it is about lessPower"+str;
}
public String sercuryable (String str){
return "it is about sercury"+str;
}
public String operation(String str){
return "it is about operation"+str;
}
public String startup(String str){
return "it is about startup"+str;
}
}
public class TestOop{
public static void main(String[] args){ Notebook n1 = new Notebook("HP","dv3000","core");
n1.lessPower("yes");
} }
求各位达达帮帮手class Computer{
public static int count=0;
String company;
String insteadof;
Computer(String n,String i){
this.company=n;
this.insteadof=i;
}
}interface technologable {
String lessPower();
String sercuryable();
}interface capabilitable{ String operation();
String startup();
}
class Notebook extends Computer implements technologable,capabilitable{
public String parameter;
Notebook(String a,String b,String c){
super(a,b);
this.parameter=c;
}
public String lessPower(String str){
return "it is about lessPower"+str;
}
public String sercuryable (String str){
return "it is about sercury"+str;
}
public String operation(String str){
return "it is about operation"+str;
}
public String startup(String str){
return "it is about startup"+str;
}
}
public class TestOop{
public static void main(String[] args){ Notebook n1 = new Notebook("HP","dv3000","core");
n1.lessPower("yes");
} }
String lessPower();
String sercuryable();
}interface capabilitable{ String operation();
String startup();
}
你想要实现的类里面的方法:
public String lessPower(String str){
return "it is about lessPower"+str;
}
public String sercuryable (String str){
return "it is about sercury"+str;
}
public String operation(String str){
return "it is about operation"+str;
}
public String startup(String str){
return "it is about startup"+str;
}
接口里面的方法签名没有带参数,但是类里面有了参数,这个不是实现了接口里面的方法,这个叫做重载,本质上就是完全不一样的方法,只是恰好方法的名字一样罢了,所以在你的类里面根本就没有是实现接口声明的方法,当然也就编译错误了