return Statement
In Java, the return statement is used to exit a method and optionally return a value to the caller of that method. The return statement is most commonly used within methods to indicate the result of the method’s execution. Here’s the syntax for the return statement: [expression] is an optional value that the method can …