📜  来自另一个类示例的 java 调用方法 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:27.493000             🧑  作者: Mango

代码示例1
public class method{
  public static void sayHello(){
    System.out.println("Hello World");
  }
}
public class app{
  public static void main(String[] args){
    method m = new method(); // Creating an instance from our class
    m.sayHello(); // using the class methods by the instance we created.
  }
}