Hi, I got few answer from other forum. Hope this forum can help me on this. There are several cases for "class A directly uses B". My question is there are any other cases besides the following cases? Thanks. 1) if class A refers to class B as a data member, local variable, argument, data cast, or if A inherits from B or if A implements interface B, then A uses B. Classes A and B interact if either A uses B or B uses A. 2)A can directly refer class B's static methods (or data members). B does not have to be a data member or local variable or argument of A 3) instanceof B 4)Class.forName() 4)Inner class: if A is an inner class of B, then objects that are instances of A generally retain the ability to access the members of outer class B. In this case, B does not have to be the data member etc of A 5) Anonymous class 6) Conditional compilation Thanks. Simon
Simon, It is not at all clear what you are asking here. Is this a "first active use" question? Perhaps it would help if you explained the problem you are trying to solve.
Download a copy of <a href="http://www.javarules.com" target="_blank" rel="nofollow"><i>"Mastering The Fundamentals of The Java Programming Language"</i></a>
Joined: Aug 16, 2000
In fact, we are doing reseach on change propagation on java program. For example, during maintenance, if we add one class or one method to the system, it might impact other parts. How do we find those impacted components at minimum effort. We need to do static analysis to find all the impacted components. That is why we are looking for all the cases that class A (or object A) uses class B (object B). Of course, we will iterately do that, thus we just need to see A directly using B. Thanks. Simon