Tomasz Kurpios

Greenhorn
+ Follow
since Oct 31, 2008
Merit badge: grant badges
For More
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 Tomasz Kurpios

Originally posted by Anut Walidera:
Which mock exam do you think the most similar to real exam ?



I think the ones provided with the K&B book are quite similar, but still more difficult.
15 years ago

Originally posted by sanjana suman:
Congratulations


Could you please tell us your preparation time and preparation list?

thanks in advance
sanjana suman.



I've prepared for a month using K&B for SCJP 6.0, lots of mock exams and by producing a lot of short programs.
15 years ago
Hi!

Today I managed to pass the SCJP 6.0 exam with surprisingly good result of 94%. Exam was MUCH easier than mock exams I took.
I was also surprised with the fact that none of the questions concerned the new features of Java 6.0, it could have been as well the SCJP 5.0 exam.

Now it's time to beat SCWCD!
Pozdrowienia // Regards
15 years ago
I think not, but only because this Integer object will be taken from the cache that Integer class provides for values between -128 to 127. If you initialized it with:


or

then it will be also eligible for GC (assuming you didn't create any other reference to it)
That is because java.io.IOException is an instance of a checked exception. You can only catch exceptions that are instances of superclasses of exceptions that can be thrown in the code surrounded by try/catch clause.

Compiler assumes that only the instances of RuntimeException may always be thrown regardless of what actually is in the code (even in empty block!). Therefore these are legal:



Pozdrowienia //Regards
My previous post refers to Marcus Moreno not Ankit Garg (who I totally agree with).

Pozdrowienia //Regards
Nope

You are forgetting that object "a" still has reference to object "b" through mh. If you don't believe me add this line after line 9 and execute the whole code:



If you override the toString() method so that it returns the String you passed to the constructor of MyObject class, you'll get the following output:


So these three objects are still accessible by a living thread.

Pozdrowienia //Regards
Hi,
I'm afraid you're wrong.

To start with, we can never assume that there is any object eligible for GC after the call to . I do understand, however, that you (and book author) actually meant commenting out whole line:



OK, so let's go back to the point. There is only 1 object eligible for GC after this commented line. Here's the explanation:

m0 references the third created object (so do m1 and m2)
m0.mh references the second created object (so do m1.mh and m2.mh)
m0.mh.mh references the first created object (so do m1.mh.mh and m2.mh.mh)

There is no reference to the fourth object.

Pozdrowienia //Regards