移动端

  • 题王微信公众号

    题王微信公众号

    微信搜“题王网”真题密题、最新资讯、考试攻略、轻松拿下考试

单选题

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) {}   }  

发布日期:2021-05-14

Which code fragments will succeed in printing the ...
A

Code fragment a.

B

Code fragment b.

C

Code fragment c.

D

Code fragment d.

E

Code fragment e.

标签: "暂无标签"

题王网让考试变得更简单

扫码关注题王,更多免费功能准备上线!

此试题出现在

Java认证考试

SCJP程序员认证考试

去刷题