Java Class Methods
You learned from the Java Methods chapter that methods are declared within a class, and that they are used to perform certain actions:
Example
Create a method named myMethod()
in Main:
public class Main {
static void myMethod() {
System.out.println("Hello World!");
}
}
myMethod()
prints a text (the action), when it is called. To call a method, write the method’s name followed by two parentheses () and a semicolon; Continue reading Java Class Methods