就是自己写两个一样的方法名,但是他们下面都有使用Scanner怎么写?
public static int sum(int a, int b){
String arrInt[] = new Scanner(System.in).nextLine().split(" ");
int a = Integer.valueOf(arrInt[0]), b = Integer.valueOf(arrInt[1]);
return a+b;
}
public static double sum(double a, double b){
double a = new Scanner(System.in).nextDouble();
double b = new Scanner(System.in).nextDouble();
return a+b;}
失败``````````` |
|