What Is Return in Java

In Java, return is a reserved keyword i.e, we can’t use it as an identifier. It is used to exit from a method, with or without a value.

What does return mean Java?

A return statement is used to exit from a method, with or without a value. For methods that define a return type, the return statement must be immediately followed by a return value. For methods that don’t return a value, the return statement can be used without a return value to exit a method.

What are return types in Java?

In Java, every method is declared with a return type such as int, float, double, string, etc. … A return keyword is used for returning the resulted value. The void return type doesn’t require any return statement. If we try to return a value from a void method, the compiler shows an error.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest