Foo has the value “”
Foo has the value null
An exception is thrown
The code will not compile
public class test( public static void main(string[]args){ string foo = args [1]; string foo = args [2]; string foo = args [3]; } ) And command line invocation: Java Test red green blue What is the result?() A、 Baz has the value of “”B、 Baz has the value of nullC、 Baz has the value of “red”D、 Baz has the value of “blue”E、 Bax has the value of “green”F、 The program throws an exception.
点击查看答案
int index = 1; String test = new String; String foo = test[index]; What is the result?()A、 Foo has the value “”B、 Foo has the value nullC、 An exception is thrownD、 The code will not compile
下列不是 String 类的方法的是()A、charAt(int index)B、indexOf(String s)C、beginWith(String s)D、endsWith(String s)
下面哪些语句能够正确地生成5个空字符串?()A、String a[]=new String[5];for(int i=0;i<5;a[i++]=“”);B、String a[]={“”,“”,“”,“”,“”};C、String a[5];D、String[5]a;E、String[]a=new String[5];for(int i=0;i<5;a[i++]=null);
下面关于数组声明和初始化的语句哪个有语法错误()A、int a1[]={3,4,5};B、String a2[]={"string1","string1","string1"};C、String a3[]=new String(3);D、int[][] a4=new int[3][3];
public class Test { public static void main( String[] args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.println(“baz = “ + baz); } } And the command line invocation: java Test red green blue What is the result?() A、 baz =B、 baz = nullC、 baz = blueD、 Compilation fails.E、 An exception is thrown at runtime.
public class Test { public static void main (String[]args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.printIn(“baz = ” + baz); } } And the output: Baz = 2 Which command line invocation will produce the output?() A、 Java Test 2222B、 Java Test 1 2 3 4C、 Java Test 4 2 4 2D、 Java Test 4 3 2 1