The future belongs to those who believe in the beauty of their dreams.Dream BIG!
SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Originally posted by Ninad Kulkarni:
If Short value is 128 or more than 128
then the answer is 2 objects eligible for garbage
otherwise answer is 1 object eligible for garbage
Originally posted by Bert Bates:
I have yet another question about this question...
Where did this question come from?
We are happy for ranchers to post mock questions for discussion, but we ask that you always cite the author of the question.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 (88 %)
Originally posted by Bert Bates:
The first version of this question used '5' as the value of the Short object. A long time ago we updated the question so that the value of the Short object was 200. We did this because wrapper objects with small values can be treated differently by the GC than other objects.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Originally posted by Bert Bates:
if the value was 5 the question wouldn't be on the exam![]()
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
SCJP 6 (91%), SCJD (91%)
Originally posted by John Sutt:
Ankit, are you sure the left side is boxed?
I thought that, if one side of the == is a primitive,
the right side would be unboxed and then, ofcourse,
the expression is true.
I'm not sure though.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
SCJP 6 (91%), SCJD (91%)
If you worry you cannot work... If you work you need not worry
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Originally posted by John Sutt:
Oh no, it has nothing to do with left or right.
I meant, if one of both sides -either left or right-
is a primitive, the other side will be unboxed.
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|