class C { public static void test(String s) { if(s == null |
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/23 20:31:13
class C { public static void test(String s) { if(s == null | s.length() == 0) { System.out.println(
class C {
public static void test(String s) {
if(s == null | s.length() == 0) {
System.out.println(“String is null”);
} else {
System.out.println(“String is not null”);
}
}
public static void main(String[] args) {
test(null);
}
}
则输出为
(A)String is null
(B)String is not null
(C)编译错误
(D)运行时异常
class C {
public static void test(String s) {
if(s == null | s.length() == 0) {
System.out.println(“String is null”);
} else {
System.out.println(“String is not null”);
}
}
public static void main(String[] args) {
test(null);
}
}
则输出为
(A)String is null
(B)String is not null
(C)编译错误
(D)运行时异常
D 会有异常.public static void test(String s)此处需要一个String类型的参数,而test(null)调用的时候传的参数是null,null是没有类型的!这样s是空的没有指向任何对象,所料无误应该报null pointer exception就在public static void test(String s)此处
class C { public static void test(String s) { if(s == null |
public class Test { public static void main(String[] agrs) {
public class Test{ public static void main(String args[]){ i
public class Breaker { static String o = "";
class Demo{public static void main (String[]args){int x = 6;
public class SystemTest { public static void main(String[] a
public class Foo { public static void main(String[] args) {
public class TreeMapDemo { public static void main(String[]
java 九九乘法表public class s99{public static void main(String[]
求告诉我错在哪里,public class zhishu {public static void main(String
阅读下面的程序,public class Student{public static void main(String
public static void main(String[] args) {