package lesson9;
public class Method {
public static void main(String[] args) { // only one main method
String a = "Joe";
sayHello(a);
sayHello("Tommy");
System.out.println(add(200, 100, 150));
}
public static void sayHello(String name) {
System.out.println("Crazy! "+ name);
}
public static int add(int a, int b, int c) {
return (a + b + c);
}
}
Method Format:
modifier --> public static
return type --> void
method name --> sayHello
parameter list in parenthesis --> (String name)
method body is enclosed between braces -->
{
System.out.println("Crazy! "+ name);
}
method name + parameter types == method signature -->
sayHello(String)