So to put it another way for Class B to have a HAS-A relationship with class A then it needs to have an instance of class A as part of its object state, in other words as one of its instance variables.
Local variables only generally exist as long as the method they reside in exists on the stack, unless the local variable is an object and that object is referenced elsewhere after the method ends and is popped off the stack.
Static variables are class variables and so pertain to the class as a whole, not an instance of the class.
Method parameters are just a signature we use to pass arguments across to a method.
Andy James wrote:can class B define variables of class A as local variable to implement HAS-A relationship?
Cay Horstmann calls this relationship as *uses* relationship(Dependency) , and
he claimed that Aggregation is a stronger form of this uses relationships, since aggregation has another object as instance variable.
and also he mentioned uses relationship denoted as -----> in UML diagram . (for more details read BIG JAVA(3rd edition) - chapter:Object-Oriented Design, page-540)