- Methods are blocks of code or sets of instructions designed to perform a specific task.
- They are executed only when called (invoked).
Advantages of Methods
- Code Modularity: Divides a large program into smaller sub-tasks by creating separate methods for each functionality, making the code easier to manage.
- Code Reusability: Once defined, a method can be invoked multiple times from different parts of the program.
- Easy Code Modification: New functionality can be added, or existing code can be modified, without impacting unrelated parts of the program.
- Improved Readability: Well-structured methods make the code cleaner and easier to understand (note: “documented” is not inherently tied to readability unless you mean well-commented code).
syntax:

Classification of Methods
-
Based on there Creation

- Predefine Method: A methods which is known by the java is known as predefine/use define method
- User Define Method: A methods which is defined by user is known as predefine/use define method
-
Based on Format Arguments

- No-Argument Methods: Methods that do not accept any parameters (e.g., void sayHello()).
- Parameterized Methods: Methods that accept one or more parameters (formal arguments, e.g., void add(int a, int b)).
-
Based on there Modifier

- Static Methods: Declared with the static keyword; belong to the class, not instances (e.g.,
static void main()).
- Non static Method: Not declared with static; belong to instances of the class. These are further classified into:
- Concrete Method: The method which are non-static and have method body(implementation).
- Abstract Method: The non static Method which does not have method body (implementation).
Terminologies:

https://excalidraw.com/#json=eHRhwp44ffk722I1llSsd,p6jKYAAX1c_Ib2pQlgFJrw
Modifier:
- Modifiers are the keywords in java which are used to alter the behavior of java members.
- Members such as -
- static (variable , methods, block, innerclass)
- Non static (variable, methods, block, innerclass, constructor)
- classes and interfaces