File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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!