Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.85 :

Posted: Fri Nov 25, 2011 11:50 am
by shkolnik

Code: Select all

 public String toString(){ return name; }; 
Please correct above line

Re: About Question com.enthuware.ets.scjp.v6.2.85 :

Posted: Sun Nov 27, 2011 8:25 pm
by admin
There is nothing wrong with it. (The extra semicolon at the end is not required but is not invalid.)

Re: About Question com.enthuware.ets.scjp.v6.2.85 :

Posted: Sun Dec 04, 2011 7:31 pm
by ETS User
I was thrown off by the do{}while(); loop.
If the q.offer(new Person("Pope"));q.offer(new Person("John")); is commented, then there is a runtime exception with the code, because "do" execs before "while" checks the condition.

Turns out your answer is correct, but code is not well-written

Re: About Question com.enthuware.ets.scjp.v6.2.85 :

Posted: Mon Dec 05, 2011 2:31 am
by admin
ETS User wrote: Turns out your answer is correct, but code is not well-written
Not sure why you think so. If you comment out important parts of any code, it will bomb :)

But seriously, you will find tricky code in the exam as well. The fact that some code is not well written, contributes to weird behavior of the code that you should be able to figure out. That is one of the aspects on which you will be tested.
HTH,
Paul.

Re: About Question com.enthuware.ets.scjp.v6.2.85 :

Posted: Wed Jun 13, 2012 1:43 am
by rgrgrg
The answer: "It will print : Helped : Pope Helped : John" would be correct, if we use "print" but not "println" in method "helpPeople". Am I wrong?