0

Help me in assignment

Consider the following java code which contains two classes Subject and Topic. Perform program analysis and identify what type of coupling exists between the two classes. Also, comments what will be the impact of this type of coupling during code maintenance phase. class Subject { Topic t = new Topic(); public void startReading() { t.understand(); } } class Topic { public void understand() { System.out.println("Software Construction"); } }

22nd Nov 2020, 6:51 PM
faheem amjad
faheem amjad - avatar
1 Answer
+ 2
The above two classes are tightly coupled. Subject class is dependent on Topic class. If Topic class's understand() method change, then you have to change the startReading() method of Subject class also accordingly. You can do a google search to read more docs and articles to get detailed understanding. Best of luck 👍
23rd Nov 2020, 11:56 AM
Lijo M Loyid
Lijo M Loyid - avatar