The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Compiles / Compiles  but generate error?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Compiles / Compiles  but generate error??" Watch "Compiles / Compiles  but generate error??" New topic

Compiles / Compiles but generate error??

swati bannore
Ranch Hand

Joined: Oct 18, 2000
Posts: 201
In the following code,the code generates compile time error as instance variable age is not initiazed.

Options are -
1)Compiles and runs with no output
2)Compiles and runs printing out The age is 1
3)Compiles but generates a runtime error
4)Does not compile
5)Compiles but generates a compile time error
Whats the difference in the options 4 and 5 .
Doesn't it mean that,When compiler error occurs,the code has not compiled..??

Swati Kale
Guoqiao Sun
Ranch Hand

Joined: Jul 18, 2001
Posts: 317
I think option 5 is a wording error, it should be:
5)Compiles but generates a runtime error
[This message has been edited by Guoqiao Sun (edited July 18, 2001).]

Guoqiao Sun<br />SCJP2 SCWCD2<br />Creator of <a href="" target="_blank" rel="nofollow"></a>, Java resource, mock exam, forum
Ranch Hand

Joined: Jul 17, 2001
Posts: 60
I think Guoqiao is right. If it generates a compile-time error then obviously it does not compile.
swati bannore
Ranch Hand

Joined: Oct 18, 2000
Posts: 201
Even I think that way .But these r the wordings.And it is from John Hunt's mock exam at
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Just a suggestion. Be VERY careful when taking any mock exams and relying on any answers to the questions provided. I have read quite a few very poorly worded questions. Hopefully one can assume that the official programmer exam is written in proper English, but do not assume under any circumstance that the mock exams are written correctly.
I agree. Here's the link:
subject: Compiles / Compiles but generate error??
It's not a secret anymore!