Hi nitin sethi,nitin sethi wrote:Hi All,
Considering the clarification given above, since i3 and i5 have been created through boxing and the value (21) given to them is also within the range of -128 to 127, i think it's quite logical that the expression i3==i5 is true. However, when I ran the code, it turned out to be false. Can anyone please explain?
Regards,
Nitin Sethi
Hama Kamal wrote:hi guys,
2- why do i get run time error for the followin?
Hama Kamal wrote:hi guys,
i'm a little confused about below issues ,, could you please help?
1- from K&B book , page 240 ,The valueOf() Methods : it states :
The two (well, usually two) static valueOf() methods provided in most of the
wrapper classes give you another approach to creating wrapper objects. Both
methods take a String representation of the appropriate type of primitive as
their first argument >>>>>>>>>>>>>>>>>>IF THE METHOD ONLY TAKES ONE ARGUMENT IT CAN BE OF TYPE OF THE PRIMITIVE BEING CONSTRUCTED AS WELL LIKE : Float f2 = Float.valueOf("3.14f"); it can be declared as Float f2 = Float.valueOf(3.14f); which means it is not only String which can be passed as argument !!
am i right?