b) Consider the following java code which contains two classes Subject and Topic. Perform program analysis and identify what typ | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponse
+ 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