In Java normally to assign the variables in instance variables and assign local variables in methods Usually...
Now Variables are passing through the parameters inside the circle brace ()..
only one return values is valid in Each method....
public class Example {
public static int multiply(int a, int b)
{
return a * b;
}
public static void main(String[] args)
{
int x = 2;
int y = 5;
// the variables x and y are arguments
int product = multiply(x, y);
System.out.println("PRODUCT IS: " + product);
}
}
Reference:https://www.geeksforgeeks.org/java/argument-vs-parameter-in-java/
Output is :
PRODUCT IS: 10
In this program the value is returned into the "product" variable
NXT don't see the directly the return values..use this System.out.println("PRODUCT IS: " + product)
This procedure to see the output in the display....
Top comments (0)