I'm trying to understand passing arguments and I've run into an issue.
Let's say I have the following code:
I pass the value 60 to the method someMethod. From there I want that value to be modified with a user input. Once it gets modified, I want it pass that value to another method called getValue. The getValue method then returns that value.
Here's the problem:
1) If I were to call someMethod, it would also call for the user input again which I don't want.
2) What is the correct way of printing out the value of the getValue method as doing:
New.getValue(int returnedValue); calls the error "unexpected type, required value, found class"
public class New {
Scanner sc = new Scanner(System.in)
private int static num1 = 60;
someMethod(num1);
public static int someMethod(int myValue)
{
//modify the integer
System.out.println("Enter in the value to modify");
myValue = sc.nextInt();
//output the value to a getter method
getValue(myValue);
return myValue;
}
public static int getValue(int returnedValue)
{
return returnedValue;
}
}
As always, if you need clarification, ask! Thanks.