📜  如何调用非静态方法 - Java 代码示例

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

代码示例1
class Program {
    public static void Main(string[] args) {
        Program p = new Program();
        p.TestMethod();
        staticFunction();
    }
    public void TestMethod() {
        Console.WriteLine("Inside non-static function");
    }
    public static void staticFunction() {
        Console.WriteLine("Inside static function");
    }
}