Define a function that acts like a statement just as you would a function that acts like an expression, with two exceptions.
The return type is void.
You do not need to include a return statement. If you want to, you can write
return;to exit the function immediately.
//========================================= // printGreeting(name) prints a greeting to // someone called name. //========================================= public static void printGreeting(String name) { System.out.println("Hello, " + name + ", how are you?"); }