Java essentialsReuse
Methods
7 min lesson
Methods are named blocks of behavior defined inside a class. They can accept parameters and return a value to the caller.
Keep in mind
A method signature communicates its return type and the information callers must provide.
Lesson.java
static String welcome(String name) {
return "Welcome, " + name + "!";
}
public static void main(String[] args) {
System.out.println(welcome("Mina"));
}What happens: Welcome, Mina!