itgle.com

publicclassTest{publicstaticvoidmain(String[]args){System.out.println(args.length>4&&args[4].equals(-d”));}}Iftheprogramisinvokedusingthecommandline:javaTestOneTwoThree–dWhatistheresult?()A.trueB.falseC.Compilationfails.D.Anexceptionisthrownatruntime.

题目
publicclassTest{publicstaticvoidmain(String[]args){System.out.println(args.length>4&&args[4].equals(-d”));}}Iftheprogramisinvokedusingthecommandline:javaTestOneTwoThree–dWhatistheresult?()

A.true

B.false

C.Compilationfails.

D.Anexceptionisthrownatruntime.


相似考题
更多“publicclassTest{publicstaticvoidmain(String[]args){System.out.println(args.length>4&&args[4].equals(-d”));}}Iftheprogramisinvokedusingthecommandline:javaTestOneTwoThree–dWhatistheresult?() ”相关问题
  • 第1题:

    publicclassTest{publicstaticvoidmain(String[]args){intx=0;assert(x>0):“assertionfailed”;System.out.println(“finished”);}}Whatistheresult?()

    A.finished

    B.Compilationfails.

    C.AnAssertionErroristhrown.

    D.AnAssertionErroristhrownandfinishedisoutput.


    参考答案:A

    Thisquestionisabittrickybecauseitlacksthefollowinginformation:Itshouldincludeastatementthatsayswhetherornotassertionsareenabled.Iftheyareindeedenabled,the
    correctionanswerisC.butiftheyarenot,thecorrectanswerisA.Assertionsarenotenabledbydefaultsoifthequestionisnotchanged,themostlogicalanswerisA.

  • 第2题:

    下面的程序会抛出什么异常类型? public class Test { public static void main(String[] args) { Object o = null; System.out.println(o); } }

    A.ArithmeticException

    B.ArrayIndexOutOfBoundsException

    C.StringIndexOutOfBoundsException

    D.没有异常


    E

  • 第3题:

    2、1、写出以下程序的输出内容。 public class Test { public static void changeValue(int value){ value = 0; } public static void main(String[] args) { int value = 2010; changeValue(value); System.out.println(value); } }


    2010

  • 第4题:

    下面代码运行后的输出结果为()。 public class Test { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(bb.equals(aa)); } } class AB{ int x = 100; }

    A.true

    B.false

    C.编译错误

    D.100


    A

  • 第5题:

    下面的程序会抛出什么异常类型? public class Test { public static void main(String[] args) { Object o = null; System.out.println(o.toString()); } }

    A.ArrayIndexOutOfBoundsException

    B.StringIndexOutOfBoundsException

    C.ClassCastException

    D.NullPointerException


    E