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); } }
- (2-5)写出下面程序运行结果。 public class Demo { public static void main(String args[]) { System.out.println(123); System.out.println(0123); System.out.println(0x123); } }
- 请阅读下面的程序,选择正确的运行结果。class Demo{private static int x ;public static void main(String[] args){System.out.println(x++);}}
- 写出程序的运行结果。 public class Demo{ public static void main(String args[]) { int b = get(); System.out.println(b); } public static int get() { try { return 1; } finally { return 2; } } }
- (4-1)写出下面程序运行结果。 public class Demo5 { public static void main(String []args) { int[] arr={12,35,8,7,2}; Arrays.sort(arr); System.out.println(arr[3]*arr.length); } }
内容
- 0
下面程序的运行结果( )public class Demo{public static int fun(int c){return c+=2;}public static void main(String[] args){int temp=fun(2);System.out.println(temp);}} A: 2 B: 4 C: 6 D: 8
- 1
请阅读下面的程序 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); } } 下列选项中,哪一个是程序的运行结果()
- 2
下列程序运行结果是( ) public class Demo { public static void main(String[] args) { Demo demo = new Demo(); demo.show(new Car() { public void run() { System.out.println("demo run"); } }); } public void show(Car c) { c.run(); } }abstract class Car { public void run() { System.out.println("car run..."); } }
- 3
下列程序运行结果是 public class Demo { public static void main(String[] args) { Object obj=new Father(){ public void show(){ System.out.println("helloworld"); } }; obj.show(); } } class Father{ public void show(){ System.out.println("hello father"); } }
- 4
下面程序运行结果为___________________。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); }}