If you have a void method then you can use return; but you do not have to and many times people don't.
If you have a method which returns a value that you need to use return JavaObject; in that method.
The returned value can be an valid Java object including exceptions, primitives and user defined objects.
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace
The return; statement on its own doesn't return void; it transfers program control back to whichever code called the current method. It should be obvious that it can only be used in a method with void instead of a return type.
The statement return 1; both transfers control back to the calling method and leaves the value 1 on the stack for the calling method to use; it can only be used in a method with a return type consistent with int.
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
ScroogeXHTML 8.2 - easy to use RTF to HTML converter library