aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Questions In kathy/Bert book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Questions In kathy/Bert book" Watch "Questions In kathy/Bert book" New topic
Author

Questions In kathy/Bert book

Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
1.On page 134 Q.2 it says given a method in a protected class?
I am thinking there is no protected class,is that a printing mistake or am I missing anything.
2.Q.5 on page 136 according to book, answer is E.I thought it is D.(I thought number 5 is not a valid declaration)
Is a method is considered as valid method declaration even if there are no curly braces(and not abstract)?
3.On page 140 I felt the option B is little ambiguous,I think it should say
The class must contain a method called public void run() from which all code for that thread will be initiated.
Any kind of help will be greatly appreciated.
Archana
Sridhar Srikanthan
Ranch Hand

Joined: Jan 08, 2003
Posts: 366
Archana,
Please refer to errata for the book
Sri
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Thank You Sri.
My 2 and 3 points are not on the errata, could anybody please explain those two.
-Archana
Sridhar Srikanthan
Ranch Hand

Joined: Jan 08, 2003
Posts: 366
Archana,
2.Q.5 on page 136 according to book, answer is E.I thought it is D.(I thought number 5 is not a valid declaration)
Is a method is considered as valid method declaration even if there are no curly braces(and not abstract)?

I think
private native void m1(); is a valid declaration.
The point you raised is exactly why this bit is given in the question. I faced a similar question on the exam.
JLS 8.4.3.4
A method that is native is implemented in platform-dependent code, typically written in another programming language such as C, C++, FORTRAN, or assembly language. The body of a native method is given as a semicolon only, indicating that the implementation is omitted, instead of a block.


JLS 8.4.5
A compile-time error occurs if a method declaration is either abstract or native and has a block for its body. A compile-time error occurs if a method declaration is neither abstract nor native and has a semicolon for its body.

Regarding the 3rd question, i think thats right too.
What is your exact question about the third one?
Hope this helps
Sri
[ February 14, 2003: Message edited by: Sri Sri ]
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Thank you sri , i really didn't know that native methods end in a semicolon.
My third question is , the option B looks correct but it says a method called run()instead of saying public void run()(The definition looks correct but it didn't specify the correct signature of the method).
So I am confused whether I should choose that as a correct answer or not if it is given in the exam.
I hope I explained my doubt clearly.
Sri I have another question,right now I am preparing kathy/Bert book,do you think i should go through the JLS before I go to exam?
-Archana
Sridhar Srikanthan
Ranch Hand

Joined: Jan 08, 2003
Posts: 366
Originally posted by Archana Annamaneni:
Thank you sri , i really didn't know that native methods end in a semicolon.
My third question is , the option B looks correct but it says a method called run()instead of saying public void run()(The definition looks correct but it didn't specify the correct signature of the method).
So I am confused whether I should choose that as a correct answer or not if it is given in the exam.
I hope I explained my doubt clearly.
Sri I have another question,right now I am preparing kathy/Bert book,do you think i should go through the JLS before I go to exam?
-Archana


Archana,
I do agree that the answer option is a bit vague, but of the given options, it seems to fit the bill. But it is lot more clear on the exam. They take a lot of care in framing the questions.
All you have to remember is
start() method creates a call stack for the thread and moves it into *runnable* state.
run() method actually does the *actual job* which is expected to be done by the thread.
And about the book vs JLS,
In most aspects , the book was more than enough for me added with Dan's explantion of concepts in his topic exams. However, if you have any further doubts about any concepts, the first thing is to refer JLS and try it out.
At the risk of being cliched, I want to say that referrring to JLS is the best way to learn.
Hope this helps
Good luck
Sridhar
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
Archana -
Thanks for your questions! We will try to answer as many of the JavaRanch posts as we can, but we are under a tight deadline to finish our next Java book.
We love it when someone jumps in and answers these questions, AND we really want to find all of the problems in the book that we can! So, if anyone asks a question on this forum and it seems to be a real problem in the book, please send us an email !
Hmmm... let me try this again... we might not always log in to JavaRanch and keep track of every thread, so when it turns out that there is a real problem with the book, PLEASE send us an email. (If you're into this kind of thing, we give credit to everyone who spots a problem in the book).
This way we won't miss anything, and we'll have the best possible book!
Thanks !
Bert and Kathy


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
Thank you sri , I got it.
Thanks for your questions! We will try to answer as many of the JavaRanch posts as we can, but we are under a tight deadline to finish our next Java book.
We love it when someone jumps in and answers these questions, AND we really want to find all of the problems in the book that we can! So, if anyone asks a question on this forum and it seems to be a real problem in the book, please send us an email !
Sure Bert, we wil definitely let you know, if there is something really wrong.
I really love your book, I will allways try to contribute whatever I can to improve the book.
-Archana
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions In kathy/Bert book