Problems with JAVA calling other class methods

if there are two classes An and B. There is a method in class B that is not in class A. The object an of class A that I want to generate needs to do something using method c in class B. So I pass an into class B, B (a), and instantiate class B to generate object b, and manipulate object a through B. c what"s going on.

Dec.02,2021

since a uses method c in B, why use to manipulate the object a through b.c? Do you still need to manipulate an object in the c () method?
if not, you can let a hold the object of B through An a = new A (b) instantiation or other methods, and then complete the a you need in the A.D () method to perform some operations using method c in class B. For example, the b.c ()


um is called in the body of the d method. I already understand. Thank you

Menu