Originally posted by Shiva Mohan:
Hashtable lhs = new Hashtable();
String p="null";
lhs.put("p", new Integer(p));
Giving runtime error.Why?
SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
� Allows null elements, keys, and values.
SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
But,I didn�t get NullPointerException when I run the same coding with Hashtable.
Originally posted by Shiva Mohan:
But,I didn�t get NullPointerException when I run the same coding with Hashtable.
SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
Are you sure?...
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Originally posted by Garrett Rowe:
That wasn't the same code as you posted the first time.
SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Originally posted by Garrett Rowe:
In the first code you wrote
String p= "test";
In the second
String p= null;
SCJP 5.0 : 88% My Story, SCWCD 1.4 : 94% My Story
kishoreballa.com
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|