Tired of repeating the same code again and again? Methods to the rescue! They let you wrap code in a reusable block.
๐งฑ What is a Method?
A method is a mini-program inside your program. It does a specific task.
Example:
public static void sayHello() {
System.out.println("Hello, world!");
}
▶️ Calling a Method
Once defined, you can use it like this:
sayHello();