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 Beginning Java and the fly likes Break Statement 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 » Java » Beginning Java
Bookmark "Break Statement" Watch "Break Statement" New topic

Break Statement

rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
Can neone tell me how to exit from a function in java?break statement is not working...!!
Apart from return statement is there any other way?
Tom Wolve
Ranch Hand

Joined: Sep 22, 2003
Posts: 32
usually 'return' is the 'right' way to exit a method in Java, throwing an exception is another.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
What do you mean by function? Can you post an example, as best as you have so far, of what you're trying to do?

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Break Statement
It's not a secret anymore!