问题:
String a = null;
a.concat(“abc”);
a.concat(“def”);
System.out.println(a);
What is the result?()
A . abc
B . null
C . abcdef
D . Compilation fails.
E . The code runs with no output.
F . An exception is thrown at runtime.
String a = null;
a.concat(“abc”);
a.concat(“def”);
System.out.println(a);
What is the result?()
● 参考解析
Exception in thread "main" java.lang.NullPointerException at X.main(X.java:12)
相关内容
相关标签