0
how important is it to write "void" if you do not want your class to return anything?
5 Answers
+ 6
So important, that if you don't, you'll get an error :)
By the way, it's void for methods not classes. You don't use void on a class.
+ 1
If you are referring to the main method in a class (public static void main (String [] args)) then if not entered then the class will not run statements like: System.out.println(); and will not print anything to the console.
0
Certainly that would be a error.But remember that constructors don't return anything not even void.
0
you need to specify that what type of class you are usimg
0
it said earlier
void for the class that u ain't want any return value. so if you don't declare it, probably an error