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
  • 1
  • 5

1 Answers1

6

Use return statement without a return value :

void print(){
    try{
        coding...
        return;
    }catch(){}
}
Eran
  • 374,785
  • 51
  • 663
  • 734