SCJP 6.0 (88%) | SCWCD 5.0 (89%)
Suresh Babu Venkat wrote:
ant hey have mentioned out put will be equal follwed by not equal.
SCJP6.0,My blog Ranchers from Delhi
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Prasad Kharkar wrote:• Two instances of the wrapper objects Boolean, Byte, Character from \u0000 to \u007f and short and integer from -128 to 127 will always be == when their primitive values are same
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
SCJP 6.0 (88%) | SCWCD 5.0 (89%)
Abimaran Kugathasan wrote:
Prasad Kharkar wrote:• Two instances of the wrapper objects Boolean, Byte, Character from \u0000 to \u007f and short and integer from -128 to 127 will always be == when their primitive values are same
applies when you creating the instances like the OP's code.
Example,
Prasad Kharkar wrote:• Two instances of the wrapper objects Boolean, Byte, Character from \u0000 to \u007f and short and integer from -128 to 127 will always be == when their primitive values are same
SCJP 6.0 (88%) | SCWCD 5.0 (89%)
Suresh Babu Venkat wrote:so does that rule apply also to Longs?
SCJP 6.0 (88%) | SCWCD 5.0 (89%)
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects
luck, db
There are no new questions, but there may be new answers.
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Darryl Burke wrote:
Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects
No. Integer caches the values from -128 to 127.
SCJP 6.0 (88%) | SCWCD 5.0 (89%)
Suresh Babu Venkat wrote:
Darryl Burke wrote:
Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects
No. Integer caches the values from -128 to 127.
what about Longs?
Deepak Bala wrote:
Suresh Babu Venkat wrote:
Darryl Burke wrote:
Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects
No. Integer caches the values from -128 to 127.
what about Longs?
What happened when your tried the same code but replaced Integer with Long ?
should print not equal according to the rule which you have mentioned as this is Long.But it is returning equal.
the same code prints notequal if we give value as more than 127 .
SCJP 6.0 (88%) | SCWCD 5.0 (89%)
Suresh Babu Venkat wrote:
Deepak Bala wrote:
Suresh Babu Venkat wrote:
Darryl Burke wrote:
Prasad Kharkar wrote:the reason is that those objects are stored in the constant pool like String objects
No. Integer caches the values from -128 to 127.
what about Longs?
What happened when your tried the same code but replaced Integer with Long ?
i have already mentioned what happened , it behaving same ...see the following quote where i have mentioned
should print not equal according to the rule which you have mentioned as this is Long.But it is returning equal.
the same code prints notequal if we give value as more than 127 .