Java return keyword is used to return (i.e., exit/terminate while returning/not returning a value) from a method called from one line of a program. The return is a reserved keyword in Java i.e, we can’t use it as an identifier. It is used to exit from a method, with or without a value.

See the following diagram.

Java Return Keyword Tutorial

In other words, calling the method takes control from the line in which the method is called to the address space of the method — after that, returning the method gives back control to the line which had invoked the method in the first place. The return keyword is an essential and frequently used part of the Java programming language (and in any programming language in general).

#java #programming #java return keyword

Java Return Keyword Example | Return Keyword in Java
4.00 GEEK