• 2021-04-14
    (2-6)请写出下面程序运行结果。
    public class Demo {
    public static void main(String[] args) {
    int b = 011001;
    System.out.println(b);
    }
    }
  • 4609

    内容

    • 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); }}