1/12
A set of vocabulary-style flashcards covering key concepts about Java functions (methods), parameters, return values, and invocation.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Java function (method)
A block of code inside a class that performs a task; in Java, a function is called a method and can return a value.
Modularity
The practice of breaking a program into small, self-contained parts to simplify development and maintenance.
Formal parameters
Parameters declared in a method signature; placeholders for inputs used inside the method.
Actual parameters
The concrete values supplied to a method when it is called.
Return type
The type of value a method returns; 'void' means no value is returned.
Return statement
The 'return' keyword sends a value back to the caller or ends the method early.
Void method
A method whose return type is void; it does not return a value.
Static method
A method that belongs to the class and can be called without creating an instance.
Instance method
A non-static method that requires an object instance to be invoked.
Calling a method
To execute a method, invoke its name on an object for non-static methods or on the class for static methods.
Return early
Using return to exit a method before all code paths have executed.
Parameters vs arguments
Formal parameters are the placeholders in the signature; actual parameters are the values passed when calling the method.
ComputeArea example
A sample method showing area calculation using radius and Math.PI.