Java Programming/Keywords/void
Appearance
From Wikibooks, open books for an open world
This is the current revision of this page, as edited by Anjishnu15 (discuss | contribs) at 14:43, 12 June 2019 (Added comment in eg). The present address (URL) is a permanent link to this version.
void
is a Java keyword.
Used at method declaration and definition to specify that the method does not return any type, the method returns void
. It is not a type and there is no void references/pointers as in C/C++.
For example:
Computer code
publicvoidmethod() { //... return;// -- In this case the return is optional //and not necessary to use public but some changes will be there }
See also: