(9-3)执行以下程序的输出结果是。
public class Demo {
public static void main(String[] args) {
try {
return;
} finally {
System.out.println("1");
}
}
}
public class Demo {
public static void main(String[] args) {
try {
return;
} finally {
System.out.println("1");
}
}
}
举一反三
- 下列程序执行的结果是( )。 public class X7_1_6 { public static void main(String[] args) { try{ return; } finally{ System.out.println("Finally"); } } }
- 写出程序的运行结果。 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; } } }
- (2-5)写出下面程序运行结果。 public class Demo { public static void main(String args[]) { System.out.println(123); System.out.println(0123); System.out.println(0x123); } }
- 下列程序运行结果是( ) 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..."); } }
- 下列程序运行结果是 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"); } }