Shin Kudo

Greenhorn
+ Follow
since Apr 17, 2009
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 Shin Kudo

Vijitha Kumara wrote:Just to add what has already said. You can't catch any specific checked exception (IOException is one of them) unless try block throws a one. But you can catch unchecked exceptions (RuntimeException).

Shin Kudo wrote:And I think the K&B book has a bug



It's not specifically mentioning which code inside the try block (in what you have posted), and what those exceptions are?




It's just a code to illustrate finally usage. But I think whatever the two exceptions are, if the try block does not throw an exception, then the compile will fail and of course, execution can not transfer to finally block.
This is overloading not overriding, and polymorphism does not apply to overloading. So the method of the reference type will be called

c1 is of type Base, even though it refers to a subclass obj. Since the subclass's print() is not an overriding version of the superclass, so the print() of the ref type will be called:



print() of Base class accept argument of type Base or any subclasses of type Base. Since Derived is subclass of Base, then this code will print "Base"

Maybe you misunderstand with the covariant return in which the return type of the overriding method can be the subclass of that of the superclass.

Here are the rules for the overriding method:
- must have the same argument list.
- must have the same return type (except the covariant return)
- may have a less restrictive access modifier.
- must not have a more restrictive access modifier.
- must not throw new or broader checked exceptions.
- may throw fewer or narrower checked exceptions, or any unchecked exceptions.
- may not throw any exceptions at all.

Hope this helps!
switch only does comparison once to find the matching case. It does not compare with other cases when it "falls through".
in K&B book at p.360:



it says "If there is no exception thrown in try block, execution transfers to // 4"

However, i just try:



--> compile error because IOException is never thrown in try {} even if try block may or may not throw an exception.

If I remove the first catch, the code compiles because Exception can catch any exception.

I just don't understand why the compiler fails. Why does it just let the second catch catches the exception? And I think the K&B book has a bug
Why don't people try to find out this obvious information themselves before they post to ask?
[] when appears behind the type applies to all variables in this declaration,
[] when appears behind a variable only applies to that particular variable.

You can see example from Arka Guhathakurta's post.
When your class extends Thread, it can't extend any other classes. That's why the Runnable's way is prefered
Congrats!

I'm going to prepare for this exam and I wish I could score as high as yours! Please tell us your successful story!
14 years ago
Many ppl think they really did well, but the outcome is not what they expected. This is so true with a hard and tricky exam like SCJP. So I recommend you prepare for it thoroughly. Try doing a lot of mock exams and when you constanly score above 70% that's the time you think to take the real exam. Good luck on your preparation!
14 years ago
Not a high score, but I'm still happy . I had some experience with Java but I didn't use it much. Now my job requires it, so I decided to take the SCJP 6.

I spent 1 month for preparation, about 2-3 hours per day to study. The K&B book is the main resource including some found on SCJP faq page which I used for preparation in the first 3 weeks (read the book about twice and the two-minute drills many times ). For the mock exams, I used Whizlab's and K&B's in the last week.

As I expected, my weaknesses are concurrency and generics. I scored poorly on these two sections with only 50% and 70% respectively. I think I need to improve these areas.

This forum also provided me a lot of useful information and helped me answer many questions I got during the preparation. Thanks everyone!

I wish I could retake the exam for free so I could get a higher score, but that's enough . Now I'm starting to study for SCWCD 5. I'm planning to prepare for it in two months' time. Hope I can get a better score
14 years ago
the trick here is after the line:

the annonymous inner class object becomes eligible for GC.

Jeena Jeen wrote:



How come does this code produce output? It doesn't even compile!
The version of ExamLab for SCJP 6.0 I downloaded is 19/04/2009 -> is it the latest?

sam jones wrote:I am currently a CS major and was curious when you think it would be suitable for someone to take this test. At the school I go to they offer the 1301 and 1302 programming classes, both of which are Java programming. Is that enough in order to pass the certification course, or would it be more beneficial to finish my degree and then take the test? I was planning on taking the summer off to work, and wanted to get some certification courses done in the down time.



I think the school knowledge will be an advantage, but you should spend time to study for the exam and doing mock tests. SCJP requires you a solid understanding of the language and it's hard. Even an experienced Java programmer may fail the test. So take your time and study for it.