File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes class dependency Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class dependency" Watch "class dependency" New topic
Author

class dependency

Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
Hi,
There are several cases for "class A 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 direct 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)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
4) Anonymous class
Simon
Jacquie Barker
author
Ranch Hand

Joined: Dec 20, 2000
Posts: 201
Note minor correction IN ALL CAPS:
2)A can directly refer to class B's PUBLIC static methods (or data members).


Author of Beginning Java Objects, Beginning C# Objects, and Taming the Technology Tidal Wave
Jacquie Barker
author
Ranch Hand

Joined: Dec 20, 2000
Posts: 201
(How about the notion of importing across packages? Strictly speaking, your answer includes this, since the purpose for importing a class B is to enable A to refer to it in several of the ways that you mention; but, it would be possible that A imports B but never accesses it ...)
Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
Thanks, Jacquie.
Any others?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class dependency
 
Similar Threads
INNER CLASS AGAIN~~~! So terrible
class dependence relation
class A uses class B
Inner classes and 'final'
Class A uses Class B