更新时间:2023-12-02 21:39:22
从
public void Method() {}
public void Method() {}
首先,使用使方法静态"命令将方法设为静态.
First, make the method static using the "Make Method Static" command.
public static void Method(){}
public static void Method(){}
然后,添加一个新类的类型的局部变量:
Then, add a local variable of the type of the new class:
public static void Method(){Class2 me = new Class2();}
public static void Method(){Class2 me = new Class2();}
然后,使用引入参数
public static void Method(Class2 me) {}
public static void Method(Class2 me) {}
然后使用使方法非静态".在 class2 中:
Then use "Make Method non-Static". In class2:
public void Method(){}
public void Method(){}