如何将一个类中的方法调用到另一个类

问题描述:

展开 | 选择 | Wrap | 行号

展开 | 选择 | Wrap | 行号



您尚未声明/创建第一个类的实例第二。尝试在构造函数中声明一个''first''类。
You have not declared/created an instance of the first class in the second. Try declaring a ''first'' class in the constructor.



他需要吗?该方法是静态的,因此不能由类而不是该类的对象调用。看看数学。要调用Math函数,您不需要声明实例。那是因为方法是静态的还是因为类是最终的?

Does he need to? The method is static so can''t it be called by the class instead of an object of that class. Take a look at Math. To call Math functions, you don''t need to declare an instance. Is that because the methods are static or because the class is final?



他需要吗?该方法是静态的,因此不能由类而不是该类的对象调用。看看数学。要调用Math函数,您不需要声明实例。那是因为方法是静态的还是因为类是最终的?
Does he need to? The method is static so can''t it be called by the class instead of an object of that class. Take a look at Math. To call Math functions, you don''t need to declare an instance. Is that because the methods are static or because the class is final?



我今天早上在太多文件之间切换,并没有全部阅读(因此我删除了一个无用的帖子;)。


:: sigh ::我试图削减,但我今天早上肯定需要咖啡......

I''m switching between too many documents this morning and didn''t read it all (hence my deletion of a useless post ;).

::sigh:: I was trying to cut back, but I definitely need coffee this morning...