This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt on return type. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt on return type." Watch "Doubt on return type." New topic

Doubt on return type.

Jeffrey Tian
Ranch Hand

Joined: Jun 02, 2010
Posts: 34
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

Joined: Jan 28, 2008
Posts: 5575
I agree. Here's the link:
subject: Doubt on return type.
It's not a secret anymore!