return method java
int a = 20;
int b = 20;
public static int sum(){
return a + b;
} // Return Function
public static void sum(){
System.out.println(a + b);
} // Void Method. it Prints and does not return anything
return method java
int a = 20;
int b = 20;
public static int sum(){
return a + b;
} // Return Function
public static void sum(){
System.out.println(a + b);
} // Void Method. it Prints and does not return anything
how to create a function that returns in java
// a method for computing the area of the rectangle
public int getArea() {
return width * height;
}
return statement in java
A return statement causes the program control to transfer back to the caller of a method.
what is return method in java
Return method is for to be able to
continue to work what method retrieves.
For example if it returns a String.
This means that you can use the returned
value in your code for
further processing.I guess good examples
of such methods are "getters".
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us