Some methods do not return values used in other computations. Instead, they are executed for some other purpose, such as to display a value.
Accordingly, Java allows you to use the void
keyword as though
void
were a data type for return values. When Java sees
void
used as though void
were a return-value data type,
Java knows that nothing is to be returned.