About 2,400,000 results
Open links in new tab
  1. How do I return a value from a Java function? - Stack Overflow

    Dec 28, 2016 · In order to make use of a return a value from a function you must assign it to a variable or use it as a test condition, etc. if(returnTen(mystery, subend, result, success) > 0){ …

  2. 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; …

  3. How to return 2 values from a Java method? - Stack Overflow

    May 14, 2010 · You can only return one value in Java, so the neatest way is like this: return new Pair<Integer>(number1, number2); Here's an updated version of your code:

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

    You declare a method's return type in its method declaration. Within the body of the method, you use the return statement to return the value. Any method declared void doesn't return a value.

  5. Java return Keyword - W3Schools

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

  6. Passing and Returning Objects in Java - GeeksforGeeks

    Dec 27, 2021 · In java, a method can return any type of data, including objects. For example, in the following program, the incrByTen ( ) method returns an object in which the value of an (an …

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

  8. How to return a value in Java - JavaPointers

    This article will help you on how to return a value in java language using the return keyword. Returning a value means storing the evaluated variable and return its data to the method …

  9. 2.5. Calling Methods that Return Values — CS Java

    When you use a method that returns a value, you need to save what it returns in a variable or use the value in some way for example by printing it out. The data type of the variable must match …

  10. 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: …

  11. Some results have been removed
Refresh