void keyword

Description
A method declaration uses the keyword void to indicate that the method does not return a value.

You can declared a void method as follows:

void SampleMethod (){
    ...
}

If a method is declared void, then its body must not contain any return statement that has an Expression.

Unlike C and C++, the Java language allows only certain forms of expressions to be used as expression statements. Note that Java does not allow a "cast to void" (void is not a type in Java) so the traditional C technique of writing an expression statement such as the following does not work in Java:

(void) ... ; // This idiom belongs to C, not to Java!

ngrelr.gif (548 bytes)
return keyword

Source: The Java Language Specification. Copyright (C) 1996 Sun Microsystems, Inc.