多选题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 } } 可能会产生下面哪两项结果?()AbeforeBbefore catchCbefore after doneDbefore catch done
多选题
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
B
before catch
C
before after done
D
before catch done
参考解析
解析:
暂无解析
相关考题:
以下Java应用程序执行入口main方法的声明中,正确的是( )。 A.public static void main()B.public static void main(String[] args)C.public static int main(String[] args)D.public void main(String[] args)
下列哪个是对main( )主方法的正确表示?A.public void static main(String args[ ]){ ... }B.void public static main(String args[ ]){ ... }C.static public void main(String args[ ]){ ... }D.以上都不正确
interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}
main方法是JavaApplication程序执行的入口点。关于main方法的方法头,下列合法的是( )。A.public static void main()B. public static void main(String[])args)C. public static iht main(String[]arg)D.public void main(String arg[])
下列程序创建了一个线程并运行,横线处应填入的正确代码是( )。 public class Try extends Thread{ public static void main(String args[]){ Thread t=new Try; ; } public void runf System.out.println(”Try!"); } }A.t.startB.t.classC.t.threadD.t.static
下列( )是对main ()主方法的正确表示。A.public void static main (String args []) {…}B.void public static main (String args []) {…}C.static public void main (String args []) {…}D.以上都不正确
以下哪个是Java应用程序main方法的有效定义? A. public static void main();B. public static void main( String args );C. public static void main( String args[] );D. public static void main( Graphics g );E. public static boolean main( String a[] );
下列程序创建了一个线程并运行,请在下划线处填入正确代码。public class Try extends Thread{public static void main(String args[]){Threadt=new Try();【 】;}public void run(){System.out.println(“Try!”);}}
以下是JAVA中正确的入口方法是? () A、 public static void main(String[] args){}B、 public static void main(String args){}C、 public void main(String[] args){}D、 public static int main(String[] args){}
Which declarations will allow a class to be started as a standalone program?() A、public void main(String args[])B、public void static main(String args[])C、public static main(String[] argv)D、final public static void main(String [] array)E、public static void main(String args[])
Public class test ( Public static void main (String args[]) ( System.out.printIn (6 ^ 3); ) ) What is the output?()
下列有关main()方法的签名正确的是哪些?()A、 public static void main(String[] args){}B、 public static void main(){}C、 public static void main(String args[]){}D、 public void static main(String[] args){}
下面哪些选项是正确的main方法说明?()A、 public main(String args[])B、 public static void main(String args[])C、 private static void main(String args[])D、 void main()
作为Java应用程序入口的main方法,其声明格式可以是()。A、public static void main(String[] args)B、public static int main(String[] args)C、public void main(String[] args)D、public int main(String[] args)
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.
main方法是Java程序执行的入口点,关于main方法的方法头以下哪项是合法的()?A、public static void main( )B、public static void main( String args[] )C、public static int main(String [] arg )D、public void main(String arg[] )
声明Java独立应用程序main()方法时,正确表达是()。A、public static void main(String[]args){…}B、private static void main(String args[]){…}C、public void main(String args[]){…}D、public static void main(){…}
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() {} } What is the result?() A、 ACB、 BDC、 ACDD、 ABCDE、 Compilation fails.
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()A、 FinallyB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?() CODE FRAGMENT a: public static void main(String args[]) { if (args.length != 0) System.out.println(args[args.length-1]); } CODE FRAGMENT b: public static void main(String args[]) { try { System.out.println(args[args.length]); } catch (ArrayIndexOutOfBoundsException e) {} } CODE FRAGMENT c: public static void main(String args[]) { int ix = args.length; String last = args[ix]; if (ix != 0) System.out.println(last); } CODE FRAGMENT d: public static void main(String args[]) { int ix = args.length-1; if (ix 0) System.out.println(args[ix]); } CODE FRAGMENT e: public static void main(String args[]) { try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {} } A、Code fragment a.B、Code fragment b.C、Code fragment c.D、Code fragment d.E、Code fragment e.
下面哪些main方法可用于程序执行()A、public static void main(String[]args)B、public static void main(String[]x)C、public static void main(Stringargs[])D、public void main(String[]args)
多选题Which declarations will allow a class to be started as a standalone program?()Apublic void main(String args[])Bpublic void static main(String args[])Cpublic static main(String[] argv)Dfinal public static void main(String [] array)Epublic static void main(String args[])
单选题Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?() CODE FRAGMENT a: public static void main(String args[]) { if (args.length != 0) System.out.println(args[args.length-1]); } CODE FRAGMENT b: public static void main(String args[]) { try { System.out.println(args[args.length]); } catch (ArrayIndexOutOfBoundsException e) {} } CODE FRAGMENT c: public static void main(String args[]) { int ix = args.length; String last = args[ix]; if (ix != 0) System.out.println(last); } CODE FRAGMENT d: public static void main(String args[]) { int ix = args.length-1; if (ix 0) System.out.println(args[ix]); } CODE FRAGMENT e: public static void main(String args[]) { try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {} }ACode fragment a.BCode fragment b.CCode fragment c.DCode fragment d.ECode fragment e.
单选题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.
单选题以下是JAVA中正确的入口方法是? ()A public static void main(String[] args){}B public static void main(String args){}C public void main(String[] args){}D public static int main(String[] args){}
填空题Public class test ( Public static void main (String args) ( System.out.printIn (6^3); ) ) What is the output? ()
单选题public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()A FinallyB Compilation fails.C The code runs with no output.D An exception is thrown at runtime.
单选题下面哪些选项是正确的main方法说明?()A public main(String args[])B public static void main(String args[])C private static void main(String args[])D void main()