2015年8月30日 星期日

[java] Static , non-static method 之間的呼叫

(1)
如果 caller - 是static method
那 callee - 只能是 static method


(2)
如果 caller - 是non static method
那 callee -
1. 如果是 static method , 直接呼叫callee所屬的className還有 methodName
    ex. className.methodName();

2. 如果是 non static method, 需要建立callee所屬的class
     ex.   className  callee = new className();
              callee.methodName();




ps. caller 呼叫方  ->  callee 被呼叫方
             


沒有留言:

張貼留言