[求助]要用接口“继承”如下 两个类,我该怎么办?
比如~ 要用接口“继承”如下 两个类,我该怎么办?//Add.java
public class Add{
double firstnum;double secondnum;
Add(double first,double second){
firstnum=first;secondnum=second;
}
public void add(){
System.out.println("相加为"+(firstnum+secondnum));
}
public static void main(String []args){
Add add1=new Add(12.56,45.56);
add1.add();
}
}
//Minus.java
public class Minus{
double first;double second;
Minus(double first1,double second2){
first=first1;second=second2;
}
public void minus(){
System.out.println("相减为"+(first-second));
}
public static void main(String []args){
Minus minus1=new Minus(145.65,56.5);
minus1.minus();
}
}