0

What's the basic difference between the 'return' and 'System.out.println' keywords when outputting something on the screen?

29th Aug 2018, 11:20 PM
StEvEn
StEvEn - avatar
3 odpowiedzi
+ 1
return its a keyword that "return" (really?) a value from a function/method and output NOTHING... Its used at example like a squareRoot method must return the square root of parameter passed to it... System.out.prinln its an method that print parameter value to standard output (console usually)
29th Aug 2018, 11:26 PM
KrOW
KrOW - avatar
+ 1
Imagine an ATM. println is like showing your balance, information is displayed but no value is given. return is like withdrawing cash, you actually get something out of the operation
30th Aug 2018, 6:47 AM
Dan Walker
Dan Walker - avatar