Model 1: Basic Java Programming - Method parameters and return values Flashcards
Method parameters and return values #
All value in Java must have
a type, and method declarations must indicate the type of parameters and the return value.
Method parameters#
Parameters are local variables
of the method
Method overloading and method signatures#
In Java, you can write two different methods with
the same name in the same class, as long as the methods take different parameter types.g
Method return values#
In java, the type of value that a method returns must be stated in the method
declaration
Every method must ______ even if the method has no return value
have its return type declared
A function for drawing a smile, for example, might not return anything at all, so it should have a return type of void.
The main method returns void#
The method main is declared with public static void. The void indicates that main
does not return a value.