calling a method with new in java code example
Example: calling method in java
public class MyClass {
void myMethod() {
System.out.println("You have called me! My name is: myMethod!");
}
public static void main(String[] args) {
new MyClass().myMethod();
}
}