Java Method Parameters & Arguments
Parameters act as variables inside the method definition. When you call a method, you supply values (arguments) that get copied into those parameters. Java is strictly Pass-by-Value: primitive argument values are copied into method parameters without affecting the caller's original variables.
"Passing by value is like photocopying a document and handing the copy to an assistant. If the assistant writes notes or crosses out a paragraph on their copy, your original master document remains pristine."
Deep Dive: How It Works
Parameters are listed in parentheses separated by commas: `(String name, int age)`.
Argument types and order must match the parameter list exactly.
Pass-by-value: modifying a primitive parameter inside the method has ZERO effect outside the method.
Syntax Blueprint
public static void greetUser(String name, int visits) {
System.out.println("Welcome " + name + ", visit #" + visits);
}Specify type and name for each parameter in the method signature.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Expecting primitive caller variable to change inside methodWhy it happens: Java copies the primitive value; it does not pass memory pointers for primitives.
How to fix: Return the updated value from the method and reassign it in the caller: x = update(x);
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Build a formatted user badge method
Write a static method "displayBadge" that takes (String role, String username).
Print "[" + role + "] " + username.
In main, call displayBadge("ADMIN", "Sarah").
Finished reading and practicing?
Mark this lesson as completed to update your course progress.