0

Please help me im a java newbie

what do you mean by "returns an int value 5" does it return value 5 to the main method or what? // returns an int value 5 static int returnFive() { return 5; }

15th Oct 2017, 5:06 PM
oyl
2 Antworten
0
Yes. Wherever you call the function you get a 5.
15th Oct 2017, 5:12 PM
1of3
1of3 - avatar
0
If you were to call "returnFive()" from the main method, say, the method "returnFive()" would return the value "5" back to where it was called from. So, if you call it like this: int a = returnFive(); It would run "returnFive()", which would return a value of five, of which the variable "a" would be assigned to have a value of.
15th Oct 2017, 5:14 PM
Quantallax