ch10 q2
posted 16 years ago
and the answer is B
but I got result of "A .".
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
and the answer is B
but I got result of "A .".
posted 16 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Do you mean chapter 10, question 2 in the SCJP Study Guide by Kathy Sierra and Bert Bates? Please mention that (or at least "K&B").
posted 16 years ago
Surely anyone naming a class _ should be shot, stabbed and then shot again. I dont think this is from Kathy and Bert's book
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
Jesper Young wrote:Do you mean chapter 10, question 2 in the SCJP Study Guide by Kathy Sierra and Bert Bates? Please mention that (or at least "K&B").
# class _ {
Surely anyone naming a class _ should be shot, stabbed and then shot again. I dont think this is from Kathy and Bert's book
posted 16 years ago
Quite probably, but it is a legal class name and thus could appear in the exam. To be honest, lots of the code I see in the books and mocks would result in physical or verbal violence!
Anyway, to the question from the unknown book of darkest mysteries....
Class "_" is called with parameters "-", "A" and "."
Now, the thing to note is the increment section of the "for" loop. It's "++x", so x will never actually be zero in this loop, it will have the values 1 and 2.
Thus the output is "A."
And if you run the code (you did run the code, didn't you, to confirm for yourself?) that is what you get.
So either the code presented here is not what was in the book, or the options given are wrong.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Deepak Bala wrote:Surely anyone naming a class _ should be shot, stabbed and then shot again. I dont think this is from Kathy and Bert's book
Quite probably, but it is a legal class name and thus could appear in the exam. To be honest, lots of the code I see in the books and mocks would result in physical or verbal violence!
Anyway, to the question from the unknown book of darkest mysteries....
Class "_" is called with parameters "-", "A" and "."
Now, the thing to note is the increment section of the "for" loop. It's "++x", so x will never actually be zero in this loop, it will have the values 1 and 2.
Thus the output is "A."
And if you run the code (you did run the code, didn't you, to confirm for yourself?) that is what you get.
So either the code presented here is not what was in the book, or the options given are wrong.
SCJP6
posted 16 years ago
I think I saw a question like this in K&B......Self Test......
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Deepak Bala wrote:I dont think this is from Kathy and Bert's book
I think I saw a question like this in K&B......Self Test......
Jason Irwin
Ranch Hand
Posts: 327
posted 16 years ago
Yeah, I'm sure it's K&B being evil with extra evil, a side of evil and an extra-large evil shake.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sachin Adat wrote:I think I saw a question like this in K&B......Self Test......
![]()
Yeah, I'm sure it's K&B being evil with extra evil, a side of evil and an extra-large evil shake.

SCJP6
Sachin Adat
Ranch Hand
Posts: 213
posted 16 years ago
Sure they are in the book, but when you are giving the exam, its just cakewalk.........
You feel its so easy.......they really toughen you for the exam.
But, anyone giving the exam beware of being careless, sometimes it makes you overconfident when you see easy questions.
You may jump straight into a pitfall....
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Jason Irwin wrote:Yeah, I'm sure it's K&B being evil with extra evil, a side of evil and an extra-large evil shake.
Sure they are in the book, but when you are giving the exam, its just cakewalk.........
You feel its so easy.......they really toughen you for the exam.
But, anyone giving the exam beware of being careless, sometimes it makes you overconfident when you see easy questions.
You may jump straight into a pitfall....
posted 16 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
The right answer is:
A.
I spotted the lack of .
A.
I spotted the lack of .
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
posted 16 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
zheng li , please before you post something next time make sure to investigate carefully the output to make sure there is really a mistake in the book before posting a question like this. This question should not have been posted in the first place if you would have notice the dot(.) in the output.
| This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |












