I've come across this in Jxam:
String s=null;
Which throws an exception?
1: if((s!=null) & (s.length()>0))
System.out.println(s);
2: if((s!=null) && (s.length()>0))
System.out.println(s);
3: if((s!=null) | (s.length()>0))
System.out.println(s);
4: if((s!=null) | | (s.length()>0))
System.out.println(s);
The answer given is 1,2,3 & 4.?
surely 2 won't throw an exception?
Thanks for any help.
Neil