:
You have a variable x. If you say x = 10, then x is the equivalent of 10. By sending x as an argument, secret(x), you have another variable which is the equivalent of the variable that is being sent. In other words, x (the variable in secret) = x (the question variable) = 10, therefore x = 10.
i = 2 * x can be thought of i = 2 * 10
So, now you have the if statement. If the condition in the brackets is met, then the code under it will execute. If else (otherwise), the code under "else" will execute. Lastly, take note that j = x/2. x will be 10, and not 20. i = 20 because of the code segment above.
j = 10/2, so what is j equal to? You are dividing x (10) by 2, which will then be the result of that calculation. Lastly, when the method returns j, it is returning j1. Whatever the calculation of j is will be returned one less than it was calculated to be in the secret method.
The "another" method is doing something similar except 2 variable's values are being sent as arguments. Also, take note that order of variable declaration as parameters will coorespond to being the values of the variables sent as arguments. If x = 5 and y = 8, then a = 5 and y = 8.
Final things to keep in mind: variable = variable * number is the same as variable *= number, which will multiply the variable and number and then have the result stored in the variable.
If x = 5, number = 2
x = x*number;
then the result of x*number will be stored in x and therefore x = 10 now.
This is very basic Java, so it would be a good idea to study up on this. If you understand the basics well, then you can further push your knowledge towards the more difficult stuff later.
Good luck,
~Barolb
