0
What is return value in java ?
I can't understand how to use return type . void and return please explain me briefly
25 Réponses
+ 3
Void is if the function doesn't return a value. If any other type is in place of void, then the function returns that type.
Example:
void hello() {
System.out.println("Hello");
}
int hello() {
return 3;
}
The void function returned nothing; it only printed "Hello". The other function returned a value of "int" type, which in this case is 3. Hope this helped.
+ 1
thanks