可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

public class Test {&en


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 true
  • B false
  • C Compilation fails.
  • D An exception is thrown at runtime.
参考答案
参考解析:

The correct answer to this question is D. The args[4] generates a runtime exception error because there are only 4 strings and the expression args[4] prints the 5th String but like it was said earlier, there are only 4 strings. 

分类:SCJP程序员认证考试题库
相关推荐

1、public class test( &en

public class test(   public int aMethod()[  static int i=0;  i++;  return I;&en...

2、Public class test (&en

Public class test ( Public static void stringReplace (String text)  ( Text = text.replace&e...

3、Public class test (&en

Public class test ( Public static void stringReplace (String text)  ( Text = text.replace&e...

4、public class Test {&en

public class Test { private static float[] f = new float[2]; public static void main(String&e...

5、public class Test {&en

public class Test { public int aMethod() { static int i = 0; i++; return i; }&en...

6、Public class test (&en

Public class test (   Public static void stringReplace (String text) (   Text =&e...