0

when is void used with a function?

19th Oct 2016, 10:12 AM
Anni Ananya
Anni Ananya - avatar
2 Answers
+ 3
It is used as the return type for functions that don't return anything. Example: public static void printn(int n) { System.out.println(n); }
19th Oct 2016, 10:16 AM
Zen
Zen - avatar
0
when any function written within the program doesn't return anything. Then we can use void as the return type.
19th Oct 2016, 7:55 PM
Jappreet Singh
Jappreet Singh - avatar