publicclasstest(publicstaticvoidmain(string[]args){stringfoo=args[1];stringfoo=args[2];stringfoo=args[3];})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?()A.Bazhasthevalueof“”B.BazhasthevalueofnullC.Bazhasthevalueof“red”D.Bazhasthevalueof“b

题目
publicclasstest(publicstaticvoidmain(string[]args){stringfoo=args[1];stringfoo=args[2];stringfoo=args[3];})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?()

A.Bazhasthevalueof“”

B.Bazhasthevalueofnull

C.Bazhasthevalueof“red”

D.Bazhasthevalueof“blue”

E.Baxhasthevalueof“green”

F.Theprogramthrowsanexception.


相似考题
更多“publicclasstest(publicstaticvoidmain(string[]args){stringfoo=args[1];stringfoo=args[2];stringfoo=args[3];})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?() ”相关问题
  • 第1题:

    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.


    参考答案:D
    ThecorrectanswertothisquestionisD.Theargs[4]generatesaruntimeexceptionerrorbecausethereareonly4stringsandtheexpressionargs[4]printsthe5thStringbutlikeitwassaidearlier,thereareonly4strings.

  • 第2题:

    publicclasstest(publicstaticvoidmain(stringargs){stringfoo=args[1];stringfoo=args;stringfoo=args;})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?()

    A.Bazhasthevalueof“”

    B.Bazhasthevalueofnull

    C.Bazhasthevalueof“red”

    D.Bazhasthevalueof“blue”

    E.Baxhasthevalueof“green”

    F.Theprogramthrowsanexception.


    参考答案:F

  • 第3题:

    main()方法的正确定义方式是()。

    A.public static void main (String [ ] args ) { new NameSurfer().start (args ) ; }

    B.public static main (String [ ] args ) { new NameSurfer().start (args ) ; }

    C.public void main (String [ ] args ) { new NameSurfer().start (args ) ; }

    D.public static void main (String [ ] args ) { NameSurfer().start (args ) ; }


    public static void main(String[] args) {}

  • 第4题:

    publicclassTest{publicstaticvoidmain(Stringargs){Stringfoo=args[1];Stringbar=args;Stringbaz=args;System.out.printIn(baz=”+baz);}}Andtheoutput:Baz=2Whichcommandlineinvocationwillproducetheoutput?()

    A.JavaTest2222

    B.JavaTest1234

    C.JavaTest4242

    D.JavaTest4321


    参考答案:C

  • 第5题:

    以下哪个main方法是正确的?

    A.public static void main(string[] args)

    B.public static void Main(String[] args)

    C.public static void main(String[] args)

    D.public static main(String[] args)

    E.public void main(String[] args)


    public static void main(String[] args)