下列程序的执行结果是 public class TestDemo { public void fun() { static int i = 0; i++; System.out.println(i); } public static void main(String args[]) { Demo d = new Demo(); d.fun(); } }
举一反三
- 18 下列程序的执行结果是?( ) public class TestDemo { public void fun() { static int i = 0; i++; System.out.println(i); } public static void main(String args[]) { Demo d = new Demo(); d.fun(); } } A: 编译错误 B: 0 C: 1 D: 运行成功,但不输出
- 下列程序的执行结果是[input=type:blank,size:4][/input] public class TestDemo { public void fun() { static int i = 0; i++; system.out.println( i); } public static void main(String args[]) { Demo d = new Demo(); d.fun(); }} 未知类型:{'options': ['编译错误', '[tex=0.5x1.286]XgTIkslIRkUR8ajnRk2deg==[/tex]', '[tex=0.5x1.286]7rcVY9u25Rg5EdwYVzpzgg==[/tex]', '运行成功,但不输出'], 'type': 102}
- 有如下代码,则该程序运行时输出结果是。 class Test{ static int i=0; public void show() { i++; System.out.println(i); } } public class Demo { public static void main(String[] args) { Test test=new Test(); test.show(); } }
- 下列代码的执行结果是 。public class Test {public int aMethod(){static int i=0;i++;System.out.println(i);}public static void main(String args[ ]){Test test = new Test();test.aMethod();}}
- 下列程序运行结果是( ) 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..."); } }