wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Coupling doubt. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Coupling doubt." Watch "Coupling doubt." New topic
Author

Coupling doubt.

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

This Question is from MasterExam:-

Which istantiation creates the tightest coupling?

A BioDiesel b1 = new BioDiesel();

B BioDiesel b2 = new BioDiesel(new String("canola"));

C BioDiesel b3 = new BioDiesel(new Integer(42));

D BioDiesel b4 = new BioDiesel(new Viscosity());


The answer is D ,but someone can explain me why it is D.Thanks..
chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

Originally posted by Ashok Pradhan:
This Question is from MasterExam:-

Which istantiation creates the tightest coupling?

A BioDiesel b1 = new BioDiesel();

B BioDiesel b2 = new BioDiesel(new String("canola"));

C BioDiesel b3 = new BioDiesel(new Integer(42));

D BioDiesel b4 = new BioDiesel(new Viscosity());


The answer is D ,but someone can explain me why it is D.Thanks..


Coupling means high Dependency on some other class. So when the other class is changed, this class is affected drastically.

in option 1, the class has no dependency on any other class

in option 2, class depends on String class, which is final. So the class definition will be constant.

in option 3, class depends on Integer class, which also is final.

in option 4, class depends on a class called Viscosity, which is developed by some other user. So there are very high chances that if Viscosity class is changed,the Biodiesel class will be affected drastically.

Hence, option 4 is correct.


Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Coupling doubt.
 
Similar Threads
Fuel Economy
K&B master exam question
coupling
Tight Coupling
Regarding coupling between classes