Eduardo Mendes

Ranch Hand
+ Follow
since Apr 30, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eduardo Mendes

This is a good example of a JVM exception: java.lang.NullPointerException

A good example of a programmer exception: com.mypackage.UserNotLoggedIn

I try to distinguish ones from the others by looking at the JVM exceptions as generic exceptions, that do not relate to any particular failure in the program logic, and to the programmer exceptions as exceptions created to signal a specific error related to the program logic.

- a NullPointerException signals that the JVM tried to invoke a method on a reference that points to null
- a com.mypackage.UserNotLoggedIn was created by the programmer to signal that a certain anonymous user tried to do an operation which requires him to be logged in.
Hi, good question. Since all Java objects implicitly extend the class Object anyway, this seems unnecessary, i.e. they might as well just make them public.
You can find some background on this in the K&B book, pages 368-369. Personally, I also struggled sometimes to distinguish ones from the others.

Anyway. This is how I understand it. A programmer exception is one created specifically to address a program-logic situation (e.g. you get the arguments into your method not formatted properly, or you define a new type of exception to deal with a special/exception case in your application's logic). On the other hand, a NullPointerException is the typical JVM exception, which is not related to any particular program-logic situation, but rather raises an issue the JVM encountered when trying to execute the program.

A bit confusing, I admit, but hope this helps somehow.

in class D you have three overloaded versions of m1(). When calling an overloaded method, the type of the arguments you pass dictate which overloaded version will be picked-up.

In your example, even though all the three object references point to the same object type (C), the object references themselves are of types A, B and C. Therefore, versions m1(A a), m1(B b) and m1(C c) will be called, printing 'ABC'.

Hope this helps.
Just in case Bert happens to open this topic:

"What I'd like to request is that if you have a doubt about this errata list or if you think you've found another error, please start another thread and include "Doubt in K&B SCJP 5: topic _____" in the Subject of the thread. That way we can all discuss it and decide whether it's a real errata or not."

Bert, am having trouble getting at least two of the topics I have raised this way, to be looked at by someone with authority to judge what to do about them. So far, it seems they indeed legitimately raise two errors in the book.

In case you have the chance to look at that, I would very much appreciate your feedback.

Many thanks,
Thanks Fred, I think I did misunderstand what we are about here. No other comments to the remaining content in your last post...
Hi everyone,

this post comes in sequence of other three posts I have submitted in this forum, about potential errors/inconsistencies found in the K&B book.

First of all, I would like to leave here my compliments and thanks to Kathy and Bert, for having made one of the best Java books I have read, covering in a very interesting and motivating way the scope of the SCJP5 exam. Now that I am getting to the last few pages of it, I can already say - regardless of whether I pass the exam or not - it was a joy to read it, and I have learned a lot.

And this brings me to the next topic. Being this indeed a great book, and so widely and fairly accepted as, if not the best, certainly one of the best to follow for the SCJP5 exam, I take all its content (even the comments in the provided answers) very seriously. Like me, many others, and therefore Bert is so right in saying that this book is subject to a much higher scrutinity than most other books. In some cases, it is indeed very difficult to just ignore an apparent inconsistency/error in the book, jumping to the next page, because the SCJP5 exam is all about (very) small details. One can program Java its whole life, and still fail in the exam because of those details. "What if I get two/three questions like this in the exam, and I fail because I did not quite digest this part very well? Is the book wrong? Is it me that hasn't understood it right?" You get the picture.

Therefore, all I would like to know is, whom should I send a message when I think I found an error in the book, and is it fair to assume that that message will be carefully looked at, and will I get an answer in reasonable time (24hour)?

I understand there is a danger that suddenly lots of people, even not so well prepared (including me, potentially, who knows), will start littering that mailbox making it difficult to manage. But could we not find a way of filtering this out somehow, from the more "generic" "Programmer Certification (SCJP)" forum? What I have experienced so far, was that, despite me having submitted my topics as advised, in the Errata page, by Bert, they did not get the attention of any of the authors, and therefore there was no conclusion for them, despite the much appreciated participation of other forum members one or two times.

Also, I do appreciate that this site is managed all by volunteers. But, given the importance it has earned in the Java world, and particularly within the group of professionals studying hard for the exam, should there not be a group of persons that would commit themselves and take over responsibility for making sure that e.g. issues related with the Errata of the SCJP5 book are not dropped from the top of the table untill they have been resolved, either by being incorporated in the "official" errata, or by telling the candidate raising the topic to study harder?

One other thing, we are all living in a "virtual" sub-world here, where no one knows each other (at least very few do) and therefore it is so easy not only to misinterpret other people's postings, but also to respond in a way that one usually wouldn't do, were we all sitting in the same office. Sometimes we do come across with some harsh comments here and there. I will do my best not to make that mistake, and would be nice to count on the same attitude from everyone else.

A very long posting, but I do hope there will be some positive conclusions drawn out of it. I will keep on coming here to learn, and hopefully to help other members when I feel I can as well.

Best wishes to all,
Sorry, but my intention is not to initiate an open unpleasant discussion here. That's what private messages are for, I guess. The reason why I am trying to get some attention to this topic is, it relates to two potential errors in the K&B book. Given that a lot of professionals, like me, are investing lots of time and effort preparing to the SCJP5 exam following this book, I think this is quite serious?
Sorry to nudge this request, but I raised two topics regarding what seems to be two mistakes in the K&B book, and which are not part of the errata. Would help me a lot (and other members, I guess) if we could get some participation on the discussion by one forum moderator. As advised in the errata page, I have named those topics "Doubt in K&B book: ..."

Manny thanks,
Any update? Maybe a little help from the forum moderators?
Any update? Maybe a little help from the forum moderators?
Sridhar, I am just not sure you have the answer to your original question. If the question was put to you as you have transcribed it here (with implements Runnable rather then extends Thread) than it is wrong, and this.yield() would never even compile, for the reasons mentioned in the previous two posts.
Royston, that's the perfect example. I would really like to get some feedback from the authors on this, and some assurance that, if the answer provided to this question is indeed wrong, a similar situation will not happen during the SCJP5 exam.
Sridhar, I know what you mean. But I am studying for the exam and if sometimes we get "pedantic" questions, where answering "it takes 10s" rather then "it takes 10s at least" makes a difference (and we have questions like that in the K&B book), then I would like to see that consistently accross the whole book. Else, I get confused about how to answer this in the exam. And that worries me a lot, for obvious reasons.