It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
7年前关闭。
但是为什么不能在方法定义中将
7年前关闭。
void
关键字仅用作返回类型,以指示方法不返回值。但是为什么不能在方法定义中将
void
用作形式参数来表示它不接受任何参数,例如:void fun(void){
...
}
最佳答案
没必要如果方法没有参数,则指定一个空的参数集()就足够了。
关于java - 为什么不将void关键字用作方法参数? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12438419/