给定下面的代码,哪些行会导致错误? 1) String str = null; 2) if ((str !=...
单项选择题 给定下面的代码,哪些行会导致错误?
1) String str = null;
2) if ((str != null) && (str.length() > 10)) {
3) System.out.println("more than 10");
4) }
5) else if ((str != null) & (str.length() < 5)) {
6) System.out.println("less than 5");
7) }
8) else { System.out.println("end"); }
A.line 1
B.line 2
C.line 5
D.line 8