网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
class Birds { public static void main(String [] args) { try { throw new Exception(); } catch (Exception e) { try { throw new Exception(); } catch (Exception e2) { System.out.print("inner "); } System.out.print("middle "); } System.out.print("outer "); } } 结果为:()
A
inner
B
inner outer
C
middle outer
D
inner middle outer
参考答案
参考解析
解析:
暂无解析
更多 “单选题class Birds { public static void main(String [] args) { try { throw new Exception(); } catch (Exception e) { try { throw new Exception(); } catch (Exception e2) { System.out.print("inner "); } System.out.print("middle "); } System.out.print("outer "); } } 结果为:()A innerB inner outerC middle outerD inner middle outer” 相关考题
考题
static void test() throws RuntimeException { try { System.out.print(”test “); throw new RuntimeException(); } catch (Exception ex) { System.out.print(”exception “); } } public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print(”runtime “); } System.out.print(”end “); } What is the result?() A、 test endB、 Compilation fails.C、 test runtime endD、 test exception endE、 A Throwable is thrown by main at runtime.
考题
public class X { public static void main(String [] args) { try { badMethod(); System.out.print(“A”); } catch (Exception ex) { System.out.print(“C”); } finally { System.out.print(“B”); } System.out.print(“D”); } public static void badMethod() { throw new Error(); } } What is the result?() A、 ABCDB、 Compilation fails.C、 C is printed before exiting with an error message.D、 BC is printed before exiting with an error message.E、 BCD is printed before exiting with an error message.
考题
static void test() { try { String x=null; System.out.print(x.toString() +“ “); } finally { System.out.print(“finally “); } } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } } What is the result?() A、 nullB、 finallyC、 null finallyD、 Compilation fails.E、 finally exception
考题
public class Test { public static void aMethod() throws Exception { try { throw new Exception(); } finally { System.out.println(“finally”); } } public static void main(String args[]) { try { aMethod(); } catch (Exception e) { System.out.println(“exception”); } System.out.println(“finished”); } } What is the result?() A、 finallyB、 exception finishedC、 finally exception finishedD、 Compilation fails.
考题
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、 mainB、 编译失败C、 代码运行,但没有输出D、 main java.lang.RuntimeException:exception
考题
现有: class Flow { public static void main(String [] args) try { System. out .print ("before") ; doRiskyThing ( ) ; System.out.print ("after ") ; } catch (Exception fe) { System.out.print ("catch") ; } System. out .println ( " done") ; } public static void doRiskyThing() throws Exception{ // this code returns unless it throws an Exception }} 可能会产生哪两项结果 ?() A、 before catchB、 before after doneC、 before catch doneD、 before after catch
考题
11.classA { 12. public void process() { System.out.print(”A “); } } 13. class B extends A { 14. public void process() throws RuntimeException { 15. super.process(); 16. if (true) throw new RuntimeException(); 17. System.out.print(“B”); }} 18. public static void main(String[] args) { 19. try { ((A)new B()).process(); } 20. catch (Exception e) { System.out.print(”Exception “); } 21. } What is the result?() A、 ExceptionB、 A ExceptionC、 A Exception BD、 A B ExceptionE、 Compilation fails because of an error in line 14.F、 Compilation fails because of an error in line 19.
考题
public class X { public static void main(String [] args) { try { badMethod(); System.out.print(“A”); } catch (RuntimeException ex) { System.out.print(“B”); } catch (Exception ex1) { System.out.print(“C”); } finally { System.out.print(“D”); } System.out.print(“E”); } public static void badMethod() { throw new RuntimeException(); } } What is the result?() A、 BDB、 BCDC、 BDED、 BCDEE、 ABCDEF、 Compilation fails.
考题
public class X { public static void main(String [] args) { try { badMethod(); System.out.print(“A”); } catch (Exception ex) { System.out.print(“B”); } finally { System.out.print(“C”); } System.out.print(“D”); } public static void badMethod() { throw new RuntimeException(); } } What is the result? () A、 ABB、 BCC、 ABCD、 BCDE、 Compilation fails.
考题
class Flow { public static void main(String [] args) { try { System.out.print("before "); doRiskyThing(); System.out.print("after "); } catch (Exception fe) { System.out.print("catch "); } System.out.println("done "); } public static void doRiskyThing() throws Exception { // this code returns unless it throws an Exception } } 可能会产生下面哪两项结果?() A、beforeB、before catchC、before after doneD、before catch done
考题
现有: void topGo() { try { middleGo(); } catch (Exception e) { System.out.print("catch"); } } void middleGo() throws Exception { go(); system.out.print("late middle"); } void go() throws ExceptiOn { throw new Exception(); } 如果调用 topGo () ,则结果为:() A、 late middleB、 catchC、 late middle catchD、 catch Iate middle
考题
static void test() throws Error { if (true) throw new AssertionError(); System.out.print(”test “); } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } System.out.print(”elld “); } What is the result?() A、 endB、 Compilation fails.C、 exception endD、 exception test endE、 A Throwable is thrown by main.F、 An Exception is thrown by main.
考题
现有: class Birds { public static void main (String [] args) { try { throw new Exception () ; } catch (Exception e) { try { throw new Exception () ; } catch (Exception e2) { System.out.print ("inner "); } System. out.print ( "middle" ) ; } System.out.print ("outer") ; } } 结果是()A、 inner outerB、 middle outerC、 inner middle outerD、.编译失败
考题
class Birds { public static void main(String [] args) { try { throw new Exception(); } catch (Exception e) { try { throw new Exception(); } catch (Exception e2) { System.out.print("inner "); } System.out.print("middle "); } System.out.print("outer "); } } 结果为:() A、innerB、inner outerC、middle outerD、inner middle outer
考题
class Order implements Runnable { public void run () { try { Thread.sleep (2000) ; } catch (Exception e) System.out.print("in") ; public static void main (String [] args) { Thread t = new Thread (new Order ()) ; t.start () ; System.out.print ("pre ") ; try { t.join () ; } catch (Exception e) { } System.out.print ("post") ; 可产生哪两项结果?() A、 pre in postB、 pre inC、 in post preD、 in pre postE、 pre post in
考题
单选题public class X { public static void main(String [] args) { try { badMethod(); System.out.print(“A”); } catch (RuntimeException ex) { System.out.print(“B”); } catch (Exception ex1) { System.out.print(“C”); } finally { System.out.print(“D”); } System.out.print(“E”); } public static void badMethod() { throw new RuntimeException(); } } What is the result?()A
BDB
BCDC
BDED
BCDEE
ABCDEF
Compilation fails.
考题
单选题static void test() { try { String x=null; System.out.print(x.toString() +“ “); } finally { System.out.print(“finally “); } } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } } What is the result?()A
nullB
finallyC
null finallyD
Compilation fails.E
finally exception
考题
单选题现有: class Birds { public static void main (String [] args) { try { throw new Exception () ; } catch (Exception e) { try { throw new Exception () ; } catch (Exception e2) { System.out.print ("inner "); } System. out.print ( "middle" ) ; } System.out.print ("outer") ; } } 结果是()A
inner outerB
middle outerC
inner middle outerD
.编译失败
考题
单选题public class X { public static void main(String [] args) { try { badMethod(); System.out.print(“A”); } catch (Exception ex) { System.out.print(“C”); } finally { System.out.print(“B”); } System.out.print(“D”); } public static void badMethod() { throw new Error(); } } What is the result?()A
ABCDB
Compilation fails.C
C is printed before exiting with an error message.D
BC is printed before exiting with an error message.E
BCD is printed before exiting with an error message.
考题
单选题static void test() throws RuntimeException { try { System.out.print(”test “); throw new RuntimeException(); } catch (Exception ex) { System.out.print(”exception “); } } public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print(”runtime “); } System.out.print(”end “); } What is the result?()A
test endB
Compilation fails.C
test runtime endD
test exception endE
A Throwable is thrown by main at runtime.
考题
单选题现有: void topGo() { try { middleGo(); } catch (Exception e) { System.out.print("catch"); } } void middleGo() throws Exception { go(); system.out.print("late middle"); } void go() throws ExceptiOn { throw new Exception(); } 如果调用 topGo () ,则结果为:()A
late middleB
catchC
late middle catchD
catch Iate middle
考题
单选题11.classA { 12. public void process() { System.out.print(”A “); } } 13. class B extends A { 14. public void process() throws RuntimeException { 15. super.process(); 16. if (true) throw new RuntimeException(); 17. System.out.print(“B”); }} 18. public static void main(String[] args) { 19. try { ((A)new B()).process(); } 20. catch (Exception e) { System.out.print(”Exception “); } 21. } What is the result?()A
ExceptionB
A ExceptionC
A Exception BD
A B ExceptionE
Compilation fails because of an error in line 14.F
Compilation fails because of an error in line 19.
考题
单选题public class X { public static void main(String [] args) { try { badMethod(); System.out.print(“A”); } catch (Exception ex) { System.out.print(“B”); } finally { System.out.print(“C”); } System.out.print(“D”); } public static void badMethod() { throw new RuntimeException(); } } What is the result? ()A
ABB
BCC
ABCD
BCDE
Compilation fails.
考题
单选题static void test() throws Error { if (true) throw new AssertionError(); System.out.print(”test “); } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } System.out.print(”elld “); } What is the result?()A
endB
Compilation fails.C
exception endD
exception test endE
A Throwable is thrown by main.F
An Exception is thrown by main.
考题
多选题class Order implements Runnable { public void run() { try { Thread.sleep(2000); } catch (Exception e) { } System.out.print("in "); } public static void main(String [] args) { Thread t = new Thread(new Order()); t.start(); System.out.print("pre "); try { t.join(); } catch (Exception e) { } System.out.print("post "); } } 可产生哪两项结果?()Ain preBpre inCin pre postDpre in post
考题
单选题public class Test { public static void aMethod() throws Exception { try { throw new Exception(); } finally { System.out.println(“finally”); } } public static void main(String args[]) { try { aMethod(); } catch (Exception e) { System.out.println(“exception”); } System.out.println(“finished”); } } What is the result?()A
finallyB
exception finishedC
finally exception finishedD
Compilation fails.
考题
单选题现有: 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
mainB
编译失败C
代码运行,但没有输出D
main java.lang.RuntimeException: exception
热门标签
最新试卷