所以我想测试Void
类型然后我写了这个简单的程序:
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!? */
}
}
所以现在当我想编译时,编译器会抱怨:
main method must return a value of type void
为什么编译器看不到我什么都没有返回并且正在使用Void
?