: Input variables passed into the method (optional). Method Body : The logic enclosed in curly braces {} . 3. Types of Methods 🟢 Standard Library Methods Built-in methods provided by Java classes. Math.sqrt(64) — returns the square root. System.out.println() — prints text to the console. 🔵 User-Defined Methods
: Break complex problems into smaller, manageable pieces. 2. Method Syntax : Input variables passed into the method (optional)
: The real values passed when calling the method. Example: Types of Methods 🟢 Standard Library Methods Built-in
: The data type the method returns (e.g., int , String ). Use void if it returns nothing. 🔵 User-Defined Methods : Break complex problems into
: The variables defined in the method signature.
public static void greetUser(String name) { // "name" is a parameter System.out.println("Hello, " + name); } public static void main(String[] args) { greetUser("Ahmed"); // "Ahmed" is an argument } Use code with caution. Copied to clipboard 5. The return Keyword