My Java 2 Exam Cram and Exam Prep books have sold well enough that the publisher has me doing a revision for a 2nd edition. Since the exam objectives have not changed significantly, this is mainly a chance to improve the example questions and make changes in organization that could not be accomplished when the 1st editions were reprinted. So - if there was anything in either book that you found confusing, badly explained, or in error, now is a great time to write me about it! firstname.lastname@example.org
Congratulations William I've always wanted to write a book ... spent 6 months trying it once. I gave up but I did learn something ... writing, good writing, is not easy; in fact, it's the hardest thing I ever tried! I'm green with envy but very happy to hear you're doing so well.
------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform
Ooooooooh... 2nd edition! Bill, your Exam Cram was the only book I had and I passed with cool percent! Now I understand why your book is so great: because you spend so much time reading folks "live" questions! Unfortunately cannot help you with errors, never could find any . As for confusion, - we have it! We have it! I was going to compose My Own Personal E-mail to Bill Brogden , but then decided to post it here. Hopefully it will facilitate the discussion and help to collect more feedback. Confusing topics: Number 1: Are string literals eligible for GC? No, really, Are string literals eligible for GC? Can anybody tell me if string literals are eligible for GC? What is the difference between getAbsolutePath() and getCanonicalPath()? Not sure it deserves special explanations in your book, may be too particular question. When You Can't Override a Method (Exam Cram, p. 152) You mentioned final and private methods. How about mentioning static methods? There is a lot of confusion about "overriding" vs. hiding static methods. The Menu-Related Classes, (Exam Cram, p. 220) There is a confusion between PopupMenu and Pull-Down menu. Well, I mean, there is a confusion in my head . Component class only pretends to implement MenuContainer interface, and pratically only Frame can host a pull-down menu. It is PopUp menu that can be added to any component, no? Gonna to buy a couple of your second edition Crams...
Hi ALL It would be nice if Bill could explain the answers to Mapraputa's questions from your book Java 2 Exam Cram. Thanks in advance.
Author and all-around good cowpoke
posted 19 years ago
Thanks for the responses. On Maraputa's questions 1. Can String literal be GCed - I think so if the only class that uses them is unloaded, but I will try to find a more definative answer. 2. Absolute Path versus Canonical Path. As near as I can tell, a canonical path is always an absolute path, but some features of a canonical path are system dependent. Looking at the SDK 1.3 docs, it appears that a canonical path may have a different form if the File object describes a path or file that does not exist, as opposed to the form if it does exist. (I don't think this happens on Windows) 3. "Overriding" and static methods. Good point - I will add material to the books. 4. Pulldown menus are restricted to Frames because only Frames can host a MenuBar. As you say a Popup menu can be added to any Component.
posted 19 years ago
Hi William, I asked Peter van der Linden about String literals being GC'd and posted his reply here http://www.javaranch.com/ubb/Forum24/HTML/007315.html . From what he said, according to the JLS they don't have to be, it's left up to the implementation. He was aware of some VM implementations that were optimized to remove them. Hope that helps. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform
String literals was covered at a JavaOne session I attended. They are not collected. They are reused if you have the same literal used more than once String string = "Test"; String string = "Test"; A better question would use new on the string to ensure the string is not sourced in the literal pool, but truly is in dynamic memory and can be GC'd. ---------------------------------- JCertify 4.0 The best investment you will make in your career all year http://www.enterprisedeveloper.com/jcertify
posted 19 years ago
dbrafford, Please read the JavaRanch Name Policy and re-register using a name that complies with the rules. Thanks for your cooperation. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform
One more suggestion. Exam Cram, Chapter 7. Flow Control And Exceptions, p.129 �If a try statement has a finally clause attached, the code block associated with finally is always executed unless the Thread executing the try dies.� Maybe to elaborate a little on how the Thread executing the try can die? Is System.exit(n); in try clause the only way to prevent finally from executing? I�ve seen this question on mocks and always thought that their authors pay too much attention to unsignificant details, until I got question about System.exit() on real exam. (I shouldn�t have said it! )
[This message has been edited by Mapraputa Is (edited March 23, 2001).]
Hey William Congrats My questions(for every body) There is a lot of confusion( to me at least) 1)Do the private methods get "inherited" ?? 2)Can we force explicilty the GC to run ( System.gc() )?? Regards Denish
Hi, Mapraputa, the thread can die if the CPU stops/power if off also beside System.exit(0). Denish, private methods r inherited but not accessible. System.gc() will give a request to the Grabage collector but it's entirely on the gc whether it'll garabge collect or not. So we can't force but can request through gc(). Correct me if i m wrong.