0

What is return value in java ?

I can't understand how to use return type . void and return please explain me briefly

19th Nov 2017, 6:09 PM
ajmal yousuf
ajmal yousuf - avatar
2 Answers
+ 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.
19th Nov 2017, 7:02 PM
cHampsonR
cHampsonR - avatar
+ 1
thanks
20th Nov 2017, 1:53 AM
ajmal yousuf
ajmal yousuf - avatar