class Calculator{
public int add(int x,int y){
return x+y;
}
public int add(String x,String y){
int tempx=Integer.parseInt(x);
int tempy=Integer.parseInt(y);
return tempx+tempy;
}
}
public class Demo01 {
public static void main(String[] args){
System.out.println(new Calculator().add(1,2));
System.out.println(new Calculator().add("11","22"));
}
}
duotai
最新推荐文章于 2024-08-20 14:34:44 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)