题目内容

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.
Code fragment c.
D. Code fragment d.
E. Code fragment e.

查看答案
更多问题

再生旋风器二级料腿应伸至()。

A. 再生器密相床层
B. 再生器密相
C. 再生器稀相
D. 再生器底部

我国公民担任检察官必须年满()

A. 18周岁
B. 20周岁
C. 23周岁
D. 25周岁

大量蛋白尿是指从尿中排泄蛋白质()

A. >100g/d
B. >150g/d
C. >1.0g/d
D. >2.0g/d
E. >3.5g/d

常用的热力膨胀阀可以分为内平衡式和()

A. 恒压式
B. 背压式
C. 外平衡式

答案查题题库