1

I need to exist from a method in a point how can I do that in Java?

void print(){
    try{
        coding...
    //I need to exist from the print method here.
    }catch(){}
}
Naasheer
  • 128
  • 2
  • 5

1 Answers1

6

Use return statement without a return value :

void print(){
    try{
        coding...
        return;
    }catch(){}
}
Eran
  • 387,369
  • 54
  • 702
  • 768