I have two classes: Controller and Viewer . They seem to be related. Can you explain this post in more detail? It is not very clear what it is and what they eat, I read the theory about classes and about this .

 class Controller { Controller(Viewer viewer) { this.viewer = viewer; } } class Viewer { Controller controller = new Controller(this); } 
  • what is not clear to you? from one object you can access another object and vice versa. Getting access means calling public methods, accessing public fields. - Artem Konovalov
  • I did not understand the record either. The code is wrong. This is not an inner class, it is 2 different classes. - Tachkin

1 answer 1

I figured it all out. so we in the Controller class have access to the Viewer class!

  • one
    Try to write more detailed answers. - Mikhail Vaysman
  • It is not the answer to the question. To leave your comments or ask the author to clarify, leave a comment to the appropriate post. - From the queue of checks - alex-rudenkiy
  • @ alex-rudenkiy, he is the author himself. - Qwertiy