Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on return type.

 
Jeffrey Tian
Ranch Hand
Posts: 37
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is a question from Enthuware(Q10 of Test 3)


What will the following class print ?



It prints out 99, 11.

The method on Line 13 has a return type as int. However, there's no return statement in the method body. Why? Is it because the first statement is throw and statements after throw won't be reachable?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic