Free Online Flashcard Deck

5 Methods and Modular Design Free Online FlashCards

Study 5 Methods and Modular Design with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a Java method?

Back

A method is a named block of code that performs a task, can receive parameters, and may return a value.

02
Front

What is modular design?

Back

Modular design builds a program from small components that can be developed, tested, and reused independently.

03
Front

What parts commonly make up a Java method declaration?

Back

A Java method declaration commonly includes a modifier, return type, name, parameter list, and method body.

04
Front

What is the difference between parameters and arguments?

Back

Parameters are variables declared by a method to describe expected inputs; arguments are the actual values supplied when the method is called.

05
Front

How is a Java method called?

Back

A method call writes the method name followed by parentheses and begins executing that method with the supplied arguments.

06
Front

What does the `void` return type mean?

Back

`void` indicates that a method performs an action without returning a value. It may use `return;` to end execution early, but cannot return a value.

07
Front

How does Java pass object and array arguments?

Back

Java passes arguments by value. For objects and arrays, the copied value is a reference, so a method can change shared contents but cannot replace the caller's reference by reassigning its parameter.

08
Front

Why return a calculation instead of always printing it?

Back

A return value communicates a result to the caller, which can store, print, compare, or pass that result to another method.

09
Front

What does variable scope mean?

Back

Scope is the region of a program in which a declared name can be referred to. A local variable is normally available only within its method or declaration block.

10
Front

What is decomposition in program design?

Back

Decomposition divides a large problem into smaller tasks, assigns each task to a method, and combines those methods through a controlling method.

11
Front

What does a method contract describe?

Back

A method contract states its purpose, inputs, output, assumptions, and side effects.

12
Front

What is method overloading?

Back

Overloading defines methods with the same name but different parameter lists. The compiler selects the version whose parameter types match the call.