+ 1
b) Consider the following java code which contains two classes Subject and Topic. Perform program analysis and identify what typ
class Subject { Topic t = new Topic(); public void startReading() { t.understand(); } } class Topic { public void understand() { System.out.println("Software Construction"); } }
1 Answer
+ 1
Question seems incomplete, but theres 2 possible types "Subject & Topic" but your main type would be "Subject " as you are creating an instance of topic in this class and can access both objects through "Subject".
https://code.sololearn.com/c1rl2MgUpwBw/?ref=app