Card 10/ 10

RecapDifficulty: Intermediate1 min

Recap: Methods and Pass-by-Value

Signatures, parameters, pass-by-value and overloading, with where each was.

Methods come down to the five ideas below, each listed with the card that covers it.

What the topic established, and which card it was on
The ideaWhere
A signature has five parts, and only the parameter list decides which method a call matchesMethod Signature Example: Reading public static int add
A parameter is a name in the declaration; an argument is a value at the callParameters vs Arguments
Java passes everything by value, and a reference is a valuePass-by-Value in Java, Including References
Mutating through the reference reaches the caller; reassigning the parameter does notPass-by-Value Example: A Method That Reassigns Its Parameter
Overloading resolves on the parameter list, never on the return typeMethod Overloading: What the Compiler Matches On

A method can change the object you gave it and can never change the variable you gave it. Anything a method needs to hand back, it hands back by returning it.