请阅读下面的程序 public class Demo { public static void sum(int a, int b) { System.out.println("int:" + (a + b)); } public static void sum(int a, float b) { System.out.println("float:" + (a + b)); } public static void sum(int a, double b) { System.out.println("double:" + (a + b)); } public static void main(String[] args) { int a = 10; long b = 20; sum(a, b); } } 下列选项中,哪一个是程序的运行结果()
举一反三
- 请阅读下面的程序public class Demo { public static int sum(int a, int b) { return a + b; } public static float sum(int a, ____ b) { _____ a + b; }}
- (2-6)请写出下面程序运行结果。 public class Demo { public static void main(String[] args) { int b = 011001; System.out.println(b); } }
- (2-6)写出下面程序运行结果。 public class Demo { public static void main(String args[]) { int a=10,b=20; a=a^b; b=b^a; System.out.println(a); System.out.println(b); } }
- 下面程序运行结果为___________________。public class MyClass{ private static int a = 19; public static void modify(int a){ a = a + 5;} public static void main(String[] args){ modify(a); System.out.println(a); }}
- public class test1 { public static int add(int a, int b) { return a+b; } public static double add(double a, double b) { return a+b; } ________________ ___________________ { ________________ ___________________ } public static void main(String[] args) { System.out.println("调用add方法:"+add(2.1,3.4,4.5)); } }