Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Best answer to pick ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Best answer to pick ?" Watch "Best answer to pick ?" New topic
Author

Best answer to pick ?

Ram Han
Ranch Hand

Joined: Feb 26, 2002
Posts: 49
I came across this question in one of the mock exams

I was really surprised about the answer they have given

Is this the way , questions will be in SCJP1.4?


class TestLevel{
public static void main(String a[]){
int i=0;
int y=i;
}
}

Choices ( choose any 1 )

1. Compile time error
2. Runtime Error
3. Compiles with warnings.
4. Compiles without warnings.
5. None of these

I choosed answer 4

But on final result it said the answer is 5 ...

I agree answer 5 is also right.
But why not 4 ?


SCJP,SCWCD,IBM 285,MCTS
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
It could just be a mistake on the listing of the answer. It seems like compiles with warnings and compiles without warnings are two statements that can never both be true or false at the same time.
Ram Han
Ranch Hand

Joined: Feb 26, 2002
Posts: 49
" Compiles with warnings "

" Compiles without warnings"

Is possible in any code, if we have any deprecated methods used we would have " Compiles with warnings "
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
What I mean is if 5 is true, that none of 1, 2, 3, and 4 happen, this couldn't happen since, assuming the code compiles, you couldn't have "compiles with warnings" and "compilers without warning" both being false at the same time.
vipul patel
Ranch Hand

Joined: Oct 16, 2005
Posts: 146
I belive answer 4 should be the right choice. i tried it and compiled. it just compiles fine. no errors & warnings.

answer 5 does not make any sense at all since option 4 is the best given answer.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Best answer to pick ?