Return statement in try catch block java

By Admin on

  • There is a situation where a method will have a return type and we can return some value at any part of the method based on the conditions.
  • So mixing these two scenarios we may have a situation to return some value from try block or catch block in such cases we need to follow some basic rules.
  • This is also one of the famous interview question  "can we write return statement in try block ", "can we write return statement in catch block ", "what will happen if we return some value in try block or catch block ", "will catch block execute after return statement " and "what are the basic rules we need to follow when we are returning or our method returning some value in try or catch blocks"
  • We will see the all the scenarios and conclusion.
SPIRO Google Plus