• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Best answer to pick ?

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
" 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
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic