0
when is void used with a function?
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);
}
0
when any function written within the program doesn't return anything. Then we can use void as the return type.