publicclassAlpha{publicstaticvoidmain(string[]args){if(args.length==2){if(args.[0].equalsIgnoreCase(-b”))System.out.println(newBoolean(args[1]));}}}Andthecodeisinvokedbyusingthecommand:javaAlpha–bTRUEWhatistheresult?()A.trueB.nullC.falseD.Compilationfails.E.Thecoderunswithnooutput.F.Anexceptionisthrownatruntime.

publicclassAlpha{publicstaticvoidmain(string[]args){if(args.length==2){if(args.[0].equalsIgnoreCase(-b”))System.out.println(newBoolean(args[1]));}}}Andthecodeisinvokedbyusingthecommand:javaAlpha–bTRUEWhatistheresult?()

A.true

B.null

C.false

D.Compilationfails.

E.Thecoderunswithnooutput.

F.Anexceptionisthrownatruntime.


相关考题:

Whichcodefragmentswillsucceedinprintingthelastargumentgivenonthecommandlinetothestandardoutput,andexitgracefullywithnooutputifnoargumentsaregiven?()CODEFRAGMENTa:publicstaticvoidmain(Stringargs[]){if(args.length!=0)System.out.println(args[args.length-1]);}CODEFRAGMENTb:publicstaticvoidmain(Stringargs[]){try{System.out.println(args[args.length]);}catch(ArrayIndexOutOfBoundsExceptione){}}CODEFRAGMENTc:publicstaticvoidmain(Stringargs[]){intix=args.length;Stringlast=args[ix];if(ix!=0)System.out.println(last);}CODEFRAGMENTd:publicstaticvoidmain(Stringargs[]){intix=args.length-1;if(ix0)System.out.println(args[ix]);}CODEFRAGMENTe:publicstaticvoidmain(Stringargs[]){try{System.out.println(args[args.length-1]);}catch(NullPointerExceptione){}}

publicclassAlpha{privatestaticCharacter()ids;publicstaticvoidmain(String[]args){ids=newCharacter[args.length];for(inti=0;iids[i]=newCharacter(args[i]);System.out.print(ids[i]);}}}Whatiscorrect?() A.Compilationfails.B.Thecoderunswithnooutput.C.Anexceptionisthrownatruntime.D.Thecoderuns,outputingaconcatenatedlistoftheargumentspassedtotheprogram.

publicclassAlpha1{publicstaticvoidmain(String[]args){booleanflag;inti=0;do{flag=false;System.out.println(i++);flag=i10;continue;}while((flag)?true:false);}}Whatistheresult?() A.000000000B.0123456789C.Compilationfails.D.Thecoderunswithnooutput.E.Thecodeentersaninfiniteloop.F.Anexceptionisthrownatruntime.

设有如下程序public class test {public static void main(String args[]) {Integer intObj=Integer.valueOf(args[args.length-1]);int i = intObj.intValue();if(args.length >1、System.out.println(i);if(args.length >0)System.out.println(i -1、;elseSystem.out.println(i - 2、;}}运行程序,输入如下命令:java test 2则输出为:A. testB. test -1C. 0D. 1E. 2

以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)

以下哪个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 X{ public static void main(String[] args){ String names[] = new String[5]; for(int x=0; x<args.length; x++) names[x]=args[x]; System.out.println(names[2]); } } 命令行执行:java X 结果是下面哪一个?A.namesB.bC.nullD.运行出现异常

给出下面一段程序,选择运行结果() public class X{ public static void main(String[] args){ String names[] = new String[5]; for(int x=0; x<args.length; x++) names[x]=args[x]; System.out.println(names[2]); } } 命令行执行:java X 结果是下面哪一个?A.运行出现异常B.bC.nullD.names

19、以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)