实例 Java 多次调用一个方法

x
 
public class Main {
  static void myMethod() {
    System.out.println("I just got executed!");
  }
  public static void main(String[] args) {
    myMethod();
    myMethod();
    myMethod();
  }
}
                    

输出结果

I just got executed!
I just got executed!
I just got executed!