public class Calculator
{
int a;
int b;
Calculator(int x,int y)
{
a=x;
b=y;
}
public static void main(String[] avgs)
{
Calculator Cal=new Calculator(4,3);
int sum=Cal.add();
int subtract=Cal.sub();
int multiplication=Cal.mul();
double division=Cal.div();
System.out.println("两数相加="+sum);
System.out.println("两数相减="+subtract);
System.out.println("两数相乘="+multiplication);
System.out.println("两数相除="+division);
}
}
public int add(int x,int y)
{
return(x+y);
}
public int sub(int x,int y)
{
return(x-y);
}
public int mul(int x,int y)
{
return(x*y);
}
public double div(int x,int y)
{
return(x/y);
}
提示24行(public int add(int x,int y))
‘class’or‘interface’expected
public int add(int x,int y)