+ 3
If 'void' in the code means it wont return a value, then how is "Hello World" even used? because System.out.println overides it?
static void sayHello() { System.out.println("Hello World!");
3 Respostas
+ 11
As has been pointed out, the string "Hello World" isn't returned by the void function. The function simply printed it without returning it to the call source.
+ 1
it doesn't return hello world..it just print hello world.
like this:
void max (int a, int b)
{
return (a> b? a:b);
}
// you can't return value like this
+ 1
It is actually a good question for the new one. Why the dislikes tho?