Introduction to Functions in Java

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/12

flashcard set

Earn XP

Description and Tags

A set of vocabulary-style flashcards covering key concepts about Java functions (methods), parameters, return values, and invocation.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

13 Terms

1
New cards

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.

2
New cards

Modularity

The practice of breaking a program into small, self-contained parts to simplify development and maintenance.

3
New cards

Formal parameters

Parameters declared in a method signature; placeholders for inputs used inside the method.

4
New cards

Actual parameters

The concrete values supplied to a method when it is called.

5
New cards

Return type

The type of value a method returns; 'void' means no value is returned.

6
New cards

Return statement

The 'return' keyword sends a value back to the caller or ends the method early.

7
New cards

Void method

A method whose return type is void; it does not return a value.

8
New cards

Static method

A method that belongs to the class and can be called without creating an instance.

9
New cards

Instance method

A non-static method that requires an object instance to be invoked.

10
New cards

Calling a method

To execute a method, invoke its name on an object for non-static methods or on the class for static methods.

11
New cards

Return early

Using return to exit a method before all code paths have executed.

12
New cards

Parameters vs arguments

Formal parameters are the placeholders in the signature; actual parameters are the values passed when calling the method.

13
New cards

ComputeArea example

A sample method showing area calculation using radius and Math.PI.