So I wanted to test Void
type then I wrote this simple program :
package ehsan;
public class NumTest {
public static Void main(String[] args) {
System.out.println("Hello, World!");
return null; /* The compiler forced me to do so. I just can't realize what is the point in returning in Void type!? */
}
}
So now when I want to compile, the compiler complains :
main method must return a value of type void
Why can't the compiler see that I'm returning nothing and am using Void
?