+ 1
void means 'no return value' then is that different with a method 'println()' ?? I don't understand the difference between return value and println()...!
6 Antworten
+ 2
If I understood right,
1) "return" is just like assignment... a value .. to method...
2) But "println" is "print it" command.
+ 1
If I'm can remember, to return a value means to bring back a value after you have run the method, while Print just means that it should print the value of something(be it a String, int, char, double, boolean, etc.) ont the screen/output screen.
+ 1
println is a predefined method in Java which returns the value you pass as parameter..
while when you make your own function and Mark it void it means that function on call won't return any value to be further used
+ 1
The main difference between print() and return is that print() is a predefined method of built-in class System where return is a statement used in a method. print() method prints the double quotes statement as it is on the screen but return statement returns the value of a variable after the execution of a method.
0
println() is a method to print something. the method is not returning a value, its just printing the value on the screen / console!
0
perfect bto