CodeIEB
Theory Notes/🗄️ Topic 4: Data & Information Management, Solution Development/10.4.6
10.4.6Grade 10

Data Transfer Between Methods

How methods talk to each other — sending data in via parameters, and getting data back out via return values.

Parameter
A variable listed in a method's definition that receives a value passed in when the method is called.
Argument
The actual value supplied when calling the method (matched to the parameter).
Return type
The data type of the value a method sends back to whoever called it.

When calling a method with parameters, the number, type and order of arguments you supply must match the method's parameter list exactly.

Example

// Method definition with two parameters and a return type public static double calculateArea(double length, double width) { return length * width; } // Calling it — arguments must match number, type, and order double area = calculateArea(5.0, 3.0);

A method with return type void does not use a return statement to send back a value (though it may use a bare `return;` to exit early).

💡 Exam Tip

Mismatching the order of arguments is a classic exam mistake — if a method expects (name, age) and you call it with (age, name), it will likely compile but produce wrong or nonsensical results since the types might coincidentally both be valid.