About 240,000 results
Open links in new tab
  1. Java return Keyword - W3Schools

    The return keyword finishes the execution of a method, and can be used to return a value from a method.

  2. Java return Keyword - GeeksforGeeks

    Jan 2, 2025 · return keyword in Java is a reserved keyword which is used to exit from a method, with or without a value. The usage of the return keyword can be categorized into two cases: 1. Methods Returning a Value. For the methods that define a return type, the return statement must be immediately followed by a return value. Example:

  3. return Keyword in Java: Usage & Examples - DataCamp

    The return keyword in Java is used to exit from a method and optionally pass back a value to the method caller. It serves as a control flow statement that terminates the execution of the method in which it appears.

  4. Java return Statement - Java Guides

    The return statement in Java is a control flow statement used to exit a method and optionally return a value to the caller. It plays a critical role in methods by indicating the end of the method's execution and providing a mechanism to pass results back to the method caller.

  5. Returning a Value from a Method (The Java™ Tutorials - Oracle

    Any method that is not declared void must contain a return statement with a corresponding return value, like this: return returnValue; The data type of the return value must match the method's declared return type; you can't return an integer value …

  6. How do I use the “return” keyword in Java?

    May 30, 2023 · The return keyword is used to return from a method when its execution is complete. When a return statement is reached in a method, the program returns to the code that invoked it. A method can return a value or reference type or does not return a value.

  7. Return Statement in Java - Tpoint Tech

    Feb 12, 2025 · In Java programming, the return statement is used for returning a value when the execution of the block is completed. The return statement inside a loop will cause the loop to break and further statements will be ignored by the compiler. The return statement is a fundamental part of Java programming.

  8. Java return keyword example - CodeJava.net

    Aug 20, 2019 · In Java, the return keyword is used to stop execution of a method and return a value for the caller. Usage of this keyword is as following: return value; where value is can be of: A reference of any Java object. A literal of String, boolean, number or null. For example: return "Peter"; int myAge = 29; return myAge; Object myObject = new Object();

  9. Return Statement In Java | Value, Object, Void With Examples // …

    A return statement in Java is used to exit a method and optionally send a value back to the caller. It can return a specific value or simply exit a void method without returning anything. In Java, the return statement plays a crucial role in controlling the flow of a program.

  10. return Java Keyword with Examples - Java Guides

    The return keyword causes a method to return to the method that called it, passing a value that matches the return type of the returning method. The return keyword is used to stop the execution of a method and return a value for the caller.

  11. Some results have been removed
Refresh