+ 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"); } }

25th Nov 2020, 5:50 PM
Tariq ali
Tariq ali - avatar
1 Respuesta
+ 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
25th Nov 2020, 6:07 PM
D_Stark
D_Stark - avatar