这两道题怎解释?为什么答案是这样的?
15. Consider the following code:
String s = null;
Which code fragments cause an object of type NullPointerException to be
thrown?
A. if((s!=null) & (s.length()>0))
B. if((s!=null) &&(s.length()>0))
C. if((s==null) | (s.length()==0))
D. if((s==null) || (s.length()==0))
AC.
16. Consider the following code:
String s = null;
Which code fragments cause an object of type NullPointerException to be
thrown?
A. if((s==null) & (s.length()>0))
B. if((s==null) &&(s.length()>0))
C. if((s!=null) | (s.length()==0))
D. if((s!=null) || (s.length()==0))
ABCD.