Methods in Java are blocks of code designed to perform specific tasks. You can reuse them to avoid repeating code.
This example defines a simple method called greet that prints a message.
greet