Maleen Abeydeera

Greenhorn
+ Follow
since Nov 10, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Maleen Abeydeera

Good Luck Ankit,
When I first saw this, I couldn't believe you still haven't done the exam! You answered a like a pro to my all my questions.
Can the K&B book be used as a complete guide to the exam? I mean if something is not there can we take it as a guarantee that, that part is not in the exam?
I have seen questions about Interface reference variable casting, daemon threads and some other topics not in that book, in some mock exams.
I also need help on the same thing.
Can somebody, who has done the exam and used Enthuware please reply
Well, I think if you run this program 1000 times, 999 times (or even 1000) you'll get "ABC". But for the SCJP exam takers (like me), what is important is the exam creators' interpretation of the problem. In KS&BB book (whom I think is on the exam development team) it is biased to the "unpredictable" answer. So I am naturally assuming that this is the official view.
If we can get this confirmed or refuted by somebody from Sun, it will be beneficial to all of us.
Devaka,
But a probability of 1% is still a probability . In the exam, we are supposed to choose the best answer . So if there's an answer called "Result is unpredictable", i think the exam requires you to select that. Am I right?

And I am sure I have seen other questions in this forum, with that kind of logic, but the answer as "unpredictable".

Need others' opinion on this.
Thanks Ankit. Great answer. Makes it look like it is really obvious.
While doing my own research, i got the following result.

class Animal<T extends Number> {} compiles, but
class Animal<T super Number> {) does not.

Is there any specific reason why?
Are you sure of the answer?
well, it seems possible to me that while thread 2 is doing the comparison, thread1 could have increased only 1 of the variables, thereby printing something.

And sure enough, when i tested the code, it printed an endless stream of j's.

Originally posted by Ganeshkumar cheekati:
yes a1.a is a part of object a1.
when a1 is null then automatically a1.a sud be null...

am i right?



when a1 is set to null, a1.a becomes null only if there is no other reference pointing to a1. In this case there is another reference a2.a which points to a1. So a1.a can still be accessed by a2.a.a

Hope this clears it up.
Thanks, Joseph and Rekha.

So my understanding is that like the String pool, an Integer pool also exists, and behaves exactly like the String pool. Am I correct?
Ganesh, I think you are having the same problem as I did.

The problem with your diagram is that a1.a is detached from a.
Do not think of a1.a as a separate reference variable. Think of it as something that is connected with the object a1. i.e it is part of a1 & should never be detached from it.
Ankit's diagram is great. Study it and you will get this.

Originally posted by Jesper Young:
Maleen, when you copy a question from a book or mock exam, we require that you quote your sources. So, please tell us where you copied this question from. This is not optional.



Jasper, I have already provided the source. look at the bottom of my post.
It's the Kathy Sierra book CD
as an extension to this problem, is there an Integer pool like a Srting pool?

I mean, when I say

Integer i = 23;
Integer j =23;
System.out.println(i==j);

it prints "true" , but

Integer i = 23;
Integer j =new Integer(23);
System.out.println(i==j);

prints "false"

can somebody explain why?
Hey Ken,
for the first part, c is a parent a reference. So the compiler is trying to access the say() of Parent, and since the types don't match it gives an error, Isn't it?
[ November 10, 2008: Message edited by: Maleen Abeydeera ]
Thanks Henry,

I was thinking of a1.a as something that belonged to the a1 reference variable, not to the actual object. That seemed to be the problem.