About 39,200,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. How to use return value from method in Java? - Stack Overflow

    Mar 11, 2015 · I want to use the return value from a member function by storing it into a variable and then using it. For example: public int give_value(int x,int y) { int a=0,b=0,c; c=a+b; return c; } pu...

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

    Within the body of the method, you use the return statement to return the value. Any method declared void doesn't return a value. It does not need to contain a return statement, but it may do so.

  5. 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.

  6. java - Using a return value from a method in another method

    May 3, 2017 · How do I use the return value from a method in another method different from the calling method?

  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. return Keyword in Java: Usage & Examples - DataCamp

    Learn how to use the `return` keyword in Java to exit methods and return values. This guide covers syntax, examples, and best practices for effective Java programming.

  9. Return statement in Java methods - Stack Overflow

    Feb 1, 2014 · Return statements stop the execution of a method and return the final value (or nothing in case of void methods). Execution continues at the place that called the method. The value you returned is used in place of the method call and calulation can continue.

  10. 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();

  11. Some results have been removed
Refresh