原始连接 http://rvelthuis.blogspot.tw/2018/01/accessing-private-methods-of-another.html Accessing private methods of another class In versions of Delphi before 10.1 Berlin, it was possible to access private members and private methods of a class simply…
如果另一个类中的那个方法是私有的话,就不能直接调用到,如果是其他类型的话看情况,如果是静态的(static)话,直接用类名可以调用到,如果是非静态的,就需要利用另一个类的实例(也就是用那个类生成的对象)来调用. 如 class A{public static void a(){}public void b(){} } public class B{public static void main(String[] args){A.a();//静态 new A().b();//非静态}}…