网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
publicclassTest{publicenumDogs{collie,harrier,shepherd};publicstaticvoidmain(String[]args){DogsmyDog=Dogs.shepherd;switch(myDog){casecollie:System.out.print(”collie);casedefault:System.out.print(”retriever);caseharrier:System.out.print(”harrier);}}}Whatistheresult?()
A.harrier
B.shepherd
C.retriever
D.Compilationfails.
E.retrieverharrier
F.Anexceptionisthrownatruntime.
参考答案
更多 “ publicclassTest{publicenumDogs{collie,harrier,shepherd};publicstaticvoidmain(String[]args){DogsmyDog=Dogs.shepherd;switch(myDog){casecollie:System.out.print(”collie);casedefault:System.out.print(”retriever);caseharrier:System.out.print(”harrier);}}}Whatistheresult?()A.harrierB.shepherdC.retrieverD.Compilationfails.E.retrieverharrierF.Anexceptionisthrownatruntime. ” 相关考题
考题
publicclassTest{publicenumDogs{collie,harrier};publicstaticvoidmain(String[]args){DogsmyDog=Dogs.collie;switch(myDog){casecollie:System.out.print(”collie);caseharrier:System.out.print(”harrier);}}}Whatistheresult?()A.collieB.harrierC.Compilationfails.D.collieharrierE.Anexceptionisthrownatruntime.
考题
publicclassTest{publicstaticvoidmain(String[]args){Stringfoo=args[1];Stringbar=args[2];Stringbaz=args[3];System.out.printIn(baz=”+baz);}}Andtheoutput:Baz=2Whichcommandlineinvocationwillproducetheoutput?()A.JavaTest2222B.JavaTest1234C.JavaTest4242D.JavaTest4321
考题
publicclasstest(publicstaticvoidmain(string[]args){stringfoo=args[1];stringfoo=args[2];stringfoo=args[3];})Andcommandlineinvocation:JavaTestredgreenblueWhatistheresult?()
A.Bazhasthevalueof“”B.BazhasthevalueofnullC.Bazhasthevalueof“red”D.Bazhasthevalueof“blue”E.Baxhasthevalueof“green”F.Theprogramthrowsanexception.
考题
publicclassTest{publicstaticvoidmain(String[]args){Stringstr=NULL;System.out.println(str);}}Whatistheresult?()
A.NULLB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.
考题
publicclassTest{publicstaticvoidmain(String[]args){Stringfoo=args[1];Stringbar=args[2];Stringbaz=args[3];System.out.println(baz=+baz);}}Andthecommandlineinvocation:javaTestredgreenblueWhatistheresult?()A.baz=B.baz=nullC.baz=blueD.Compilationfails.E.Anexceptionisthrownatruntime.
考题
publicclassTest{privatestaticint[]x;publicstaticvoidmain(String[]args){System.out.println(x[0]);}}Whatistheresult?()
A.0B.nullC.Compilationfails.D.ANullPointerExceptionisthrownatruntime.E.AnArrayIndexOutOfBoundsExceptionisthrownatruntime.
考题
publicclassTest{publicstaticvoidmain(String[]args){System.out.println(args.length4args[4].equals(-d”));}}Iftheprogramisinvokedusingthecommandline:javaTestOneTwoThree–dWhatistheresult?()
A.trueB.falseC.Compilationfails.D.Anexceptionisthrownatruntime.
考题
以下哪个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 class Test { public static void main(String[] args) { Object o = new Object(); String d = (String)o; } }A.ArithmeticExceptionB.ArrayIndexOutOfBoundsExceptionC.StringIndexOutOfBoundsExceptionD.ClassCastException
热门标签
最新试卷