void 是一個 Java 關鍵字。
void
在方法宣告和定義中使用,用於指定該方法不返回任何型別,該方法返回 void。它不是一種型別,也沒有 void 引用/指標,如在 C/C++ 中。
例如
public void method() { //... return; // -- In this case the return is optional //and not necessary to use public but some changes will be there }
參見