[OT] Weird Boolean/ Wrapper class bug
[OT] Weird Boolean/ Wrapper class bug
- Subject: [OT] Weird Boolean/ Wrapper class bug
- From: "Shravan Kumar. M" <email@hidden>
- Date: Sat, 21 Nov 2009 07:23:01 -0800 (PST)
Hello Group,
Boolean a = null;
if(a != null)
System.out.println("s");
else
System.out.println("n");
----------
Above code block raises NullPointerException, where as below one runs successfully!!! Same is the case with any wrapper class (Integer, Long, ...).
*Its wondering what it makes difference
in checking (a != null) and (a == null)? Its just an Object check rt!*
Exact exception: java.lang.NullPointerException at booleanValue()
----------
Boolean a = null;
if(a == null)
System.out.println("s");
else
System.out.println("n");
Thank You,
Shravan Kumar. M
--------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden