下列程序运行的结果是( )。public class Demo { public static void main(String[] args) { String[] strs = new String[3]; System.out.println(str[0].equals("abc")); }}
A: true
B: false
C: 编译出错
D: 抛出NullPointerException空指针异常
A: true
B: false
C: 编译出错
D: 抛出NullPointerException空指针异常
举一反三
- public class Test { public static void main(String[] args) { String s1 = "abc"; String s2 = new String ("abc"); System.out.println(s1 == s2); } } 程序运行结果是
- 下列程序的运行结果是()public class Test {public static void main(String[] args) {String str = NULL;System.out.println(str);}} A:
- 以下程序运行结果为? public class Q { public static void main(String argv[]) { String a[]= new String[5]; System.out.println(a[0]); } }
- public class Example{ public static void main(String[] args) { String[] strs = { "Tom", "Jerry", "Donald" }; // foreach循环遍历数组 for (String str : strs) { str = "Tuffy"; } System.out.println(strs[0] + "," + strs[1] + "," + strs[2]); } } 下列选项中,程序的运行结果是
- public class ArrayTest{ public static void main ( String args[] ) { String s[] = new String[5]; System.out.println(s[0]); }}哪个叙述为真? A: 运行出错 B: 输出 0 C: 输出 null D: 出现编译错误