网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
public class Yippee { public static void main(String [] args) { for(int x = 1; x < args.length; x++) { System.out.print(args[x] +“ “); } } } and two separate command line invocations: java Yippee java Yippee 1234 What is the result?()
A
No output is produced. 123
B
No output is produced. 234
C
No output is produced. 1234
D
An exception is thrown at runtime. 123
E
An exception is thrown at runtime. 234
F
An exception is thrown at rijntime. 1234
参考答案
参考解析
解析:
暂无解析
更多 “单选题public class Yippee { public static void main(String [] args) { for(int x = 1; x args.length; x++) { System.out.print(args[x] +“ “); } } } and two separate command line invocations: java Yippee java Yippee 1234 What is the result?()A No output is produced. 123B No output is produced. 234C No output is produced. 1234D An exception is thrown at runtime. 123E An exception is thrown at runtime. 234F An exception is thrown at rijntime. 1234” 相关考题
考题
public class Pass{public static void main(String[]args){int x=5;Pass p=new Pass();p.doStuff(x);System.out.print(mainx=+x);}void doStuff(intx){System.out.print(doStuffx=+x++);}}What is the result?()A.Compilation fails.B.An exception is thrown at runtime.C.doStuff x=6 main x=6D.doStuff x=5 main x=5E.doStuff x=5 main x=6F.doStuff x=6 main x=5
考题
Given the command line java Pass2 and:public class Pass2{public void main(String[]args){int x=6;Pass2 p=new Pass2();p.doStuff(x);System.out.print(mainx=+x);}void doStuff(intx){System.out.print(doStuffx=+x++);}}What is the result?()A.Compilation fails.B.An exception is thrown at runtime.C.doStuffx=6 main x=6D.doStuffx=6 mainx =7E.doStuffx=7 mainx =6F.doStuffx=7 mainx =7
考题
public class Yippee2{stati cpublic void main(String[]yahoo){for(intx=1;xSystem.out.print(yahoo[x]+);}}}and the command line invocation:java Yippee2 a b cWhat is the result?()
A.abB.bcC.abcD.Compilation fails.E.An exception is thrown at runtime.
考题
public class AssertStuff { public static void main(String [] args) { int x= 5; int y= 7; assert (x y): “stuff”; System.out.println(”passed”); } } And these command line invocations:java AssertStuff java -ea AssertStuff What is the result?()A、 passed stuffB、 stuff passedC、 passed An AssertionError is thrown with the word “stuff” added to the stack trace.D、 passed An AssertionError is thrown without the word “stuff” added to the stack trace.E、 passed An AssertionException is thrown with the word “stuff” added to the stack trace.F、 passed An AssertionException is thrown without the word “stuff” added to the stack trace.
考题
public class Yippee2 { static public void main(String [] yahoo) { for(int x= 1; xSystem.out.print(yahoo[x] + “ “); } } } and the command line invocation: java Yippee2 a b c What is the result?() A、a bB、b cC、a b cD、 Compilation fails.E、 An exception is thrown at runtime.
考题
public class Alpha{ public static void main( string[] args ){ if ( args.length == 2 ) { if ( args.[0].equalsIgnoreCase(“-b”) ) System.out.println( new Boolean( args[1] )); } } } And the code is invoked by using the command: java Alpha –b TRUE What is the result?() A、 trueB、 nullC、 falseD、 Compilation fails.E、 The code runs with no output.F、 An exception is thrown at runtime.
考题
Given the command line java Pass2 and: public class Pass2 { public void main(String [] args) { int x=6; Pass2 p = new Pass2(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuffx = “+ x++); } } What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 doStuffx = 6 main x = 6D、 doStuffx = 6 main x = 7E、 doStuffx = 7 main x = 6F、 doStuffx = 7 main x = 7
考题
public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?() A、 baz =B、 baz = nullC、 baz = blueD、 Compilation fails.E、 An exception is thrown at runtime.
考题
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 Pass { public static void main(String [1 args) { int x 5; Pass p = new Pass(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuff x = “+ x++); } } What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 doStuffx = 6 main x = 6D、 doStuffx = 5 main x = 5E、 doStuffx = 5 main x = 6F、 doStuffx = 6 main x = 5
考题
public class Yippee { public static void main(String [] args) { for(int x = 1; x args.length; x++) { System.out.print(args[x] +“ “); } } } and two separate command line invocations: java Yippee java Yippee 1234 What is the result?() A、 No output is produced. 123B、 No output is produced. 234C、 No output is produced. 1234D、 An exception is thrown at runtime. 123E、 An exception is thrown at runtime. 234F、 An exception is thrown at rijntime. 1234
考题
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.
考题
public classYippee{ public static void main(String[]args){ for(intx=1;xSystem.out.print(args[x]+""); } } } and two separate command line invocations:j avaYippee javaYippee1234 What is the result?()A、No output is produced. 123B、No output is produced. 234C、No output is produced. 1234D、An exception is thrown at runtime. 123E、An exception is thrown at runtime. 234F、An exception is thrown at runtime. 1234
考题
public class Test { public static void main(String [] args) { System.out.println(args.length 4 args[4].equals(“-d”)); } } If the program is invoked using the command line: java Test One Two Three –d What is the result?() A、 trueB、 falseC、 Compilation fails.D、 An exception is thrown at runtime.
考题
单选题public class Test { public static void main(String [] args) { System.out.println(args.length 4 args[4].equals(“-d”)); } } If the program is invoked using the command line: java Test One Two Three –d What is the result?()A
trueB
falseC
Compilation fails.D
An exception is thrown at runtime.
考题
单选题public class Pass { public static void main(String [1 args) { int x 5; Pass p = new Pass(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuff x = “+ x++); } } What is the result?()A
Compilation fails.B
An exception is thrown at runtime.C
doStuffx = 6 main x = 6D
doStuffx = 5 main x = 5E
doStuffx = 5 main x = 6F
doStuffx = 6 main x = 5
考题
单选题Given the command line java Pass2 and: public class Pass2 { public void main(String [] args) { int x=6; Pass2 p = new Pass2(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuffx = “+ x++); } } What is the result?()A
Compilation fails.B
An exception is thrown at runtime.C
doStuffx = 6 main x = 6D
doStuffx = 6 main x = 7E
doStuffx = 7 main x = 6F
doStuffx = 7 main x = 7
考题
单选题Given the command line java Pass2 and: public class Pass2{ public void main(String[]args){ int x=6; Pass2 p=new Pass2(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()A
Compilation fails.B
An exception is thrown at runtime.C
doStuffx=6 main x=6D
doStuffx=6 mainx =7E
doStuffx=7 mainx =6F
doStuffx=7 mainx =7
考题
单选题public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?()A
baz =B
baz = nullC
baz = blueD
Compilation fails.E
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.
考题
单选题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.
考题
单选题public classYippee{ public static void main(String[]args){ for(intx=1;xSystem.out.print(args[x]+""); } } } and two separate command line invocations:j avaYippee javaYippee1234 What is the result?()A
No output is produced. 123B
No output is produced. 234C
No output is produced. 1234D
An exception is thrown at runtime. 123E
An exception is thrown at runtime. 234F
An exception is thrown at runtime. 1234
考题
单选题public class AssertStuff { public static void main(String [] args) { int x= 5; int y= 7; assert (x y): “stuff”; System.out.println(”passed”); } } And these command line invocations:java AssertStuff java -ea AssertStuff What is the result?()A
passed stuffB
stuff passedC
passed An AssertionError is thrown with the word “stuff” added to the stack trace.D
passed An AssertionError is thrown without the word “stuff” added to the stack trace.E
passed An AssertionException is thrown with the word “stuff” added to the stack trace.F
passed An AssertionException is thrown without the word “stuff” added to the stack trace.
考题
单选题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 Alpha{ public static void main( string[] args ){ if ( args.length == 2 ) { if ( args.[0].equalsIgnoreCase(“-b”) ) System.out.println( new Boolean( args[1] )); } } } And the code is invoked by using the command: java Alpha –b TRUE What is the result?()A
trueB
nullC
falseD
Compilation fails.E
The code runs with no output.F
An exception is thrown at runtime.
考题
单选题public class Yippee2 { static public void main(String [] yahoo) { for(int x= 1; xSystem.out.print(yahoo[x] + “ “); } } } and the command line invocation: java Yippee2 a b c What is the result?()A
a bB
b cC
a b cD
Compilation fails.E
An exception is thrown at runtime.
考题
单选题public class Pass{ public static void main(String[]args){ int x=5; Pass p=new Pass(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()A
Compilation fails.B
An exception is thrown at runtime.C
doStuff x=6 main x=6D
doStuff x=5 main x=5E
doStuff x=5 main x=6F
doStuff x=6 main x=5
热门标签
最新试卷