How to find out from a Java class method whether there is an object of another, given, Java class?

67 Views Asked by At

Good day! I have an Apache Netbeans module with several Java classes in it. I'd like to find out when executing a method belonging to an object of, say, class A if another class (class B) had already been instantiated and in this case discover what is this object so that I can call one of its methods from the class A object method. So I am not trying to find out the class of a given object, I am trying to find if there is an object of a given class. Any ideas? Thanks! Erminio.

I didn't try any code because I really have no idea where to start.

0

There are 0 best solutions below