+ 1
Void returning no value?
so void doesn't return any value, my first thought is that the method is returning a string "hello world" which is in my eyes a value? are strings not values ? or is there somewhere else a value would be returned other than the console?
3 Respuestas
+ 7
Outputting a value to the screen is different from returning it, actually. If the method were to return "Hello world", you'd have to store it somewhere or print it out yourself.
Ex:
String result = SayHello();
System.out.print(SayHello());
+ 7
If a value is returned and nothing is done with it, it's just discarded.
+ 3
So Values cannot be "returned" unless there is somewhere to store it or print out yourself, and you cannot store or print out unless a value is returned ? so is "return" just a description of what's happened after the event ? can you "return" a value and it get stuck because there's nowhere to store it or print out?