class ThreadExcept implements Runnable { public void run() { throw new RuntimeException("exception "); } public static void main(String [] args) { new Thread(new ThreadExcept()).start(); try { int x = Integer.parseInt(args[0]); Thread.sleep(x); System.out.print("main "); } catch (Exception e) { } } } 和命令行: java ThreadExcept 1000 哪一个是结果?()
A、 main
B、 编译失败
C、 代码运行,但没有输出
D、 main java.lang.RuntimeException:exception
相关问题推荐
-
两个线程并发执行以下代码,假设a是全局变量,那么以下输出()哪个是可能的。
A、32
B、23
C、33
D、22
-
现有代码片段: String s="123"; String sl=S+456; 请问sl的结果是哪项?()
A、 123456
B、 579
C、编译错误
D、运行时抛出异常
-
this()和super()只能位于构造函数中的第一句
A、对
B、错
-
下面哪些说法是正确的()
A、静态方法不能被覆盖
B、私有方法不能被重载
C、实例变量能够被隐藏
D、静态方法能够被重载
-
现有: 1. abstract class Color2 { 2. //insert code here 3. } 4. 5. public class Blue2 extends Color2 { 6.public String getRGB() { return "blue"; } 7. } 和4个声明: public abstract String getRGB(); abstract String getRGB(); private abstract String getRGB(); protected abstract String getRGB(); 分别插入到第2行,有多少行可以编译?()
A、 0
B、 1
C、 2
D、 3