This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock question doubt

 
raja kanak
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
13) public void divide(int a, int b) {
try {
int c = a / b;
}
catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}
1) Prints out: Finally
2) Prints out: Exception
3) Prints out: Exception Finally
4) No output
4tests.com says the answer is 3.
But i think it is 4 (assuming a=1; b=1)

Am i right?
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The output will always include the word Finally.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic