Codependent Objects

Create a Java file containing a class/object called CodependentObjectOne. Give it a single void method named a(). Have the method print something about "A" on the screen when called.

Then, inside ObjectOne's a() method, also create an instance of a CodependentObjectTwo object and then call its b() method.

Create a second Java file called CodependentObjectTwo with a method named b(). That method should print something about "B" on the screen and then create an instance of an ObjectOne and call its a() method.

The file containing the main() method has been written for you. Download it for testing, but don't change it and there's no need to turn it in.

Files Needed




©2003–2016 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License