ASSIŲnnel HUL SUDIEU
Due date: 2020-10-14, 23:59 IST.
1) If method A uses a variable v shared with method B, where A writes to v and B reads from y, then, it is an example of which kind of coupling interface 1 point
listed below?
External device coupling
O Parameter coupling
Interface coupling,
Shared data coupling
1 point
wer from the options below. .A node in a callee function that defines a variable x and has a def-clear path from the node through a call
Answers
Answer:
Explanation:
// Java program to illustrate
// tight coupling concept
class Subject {
Topic t = new Topic();
public void startReading()
{
t.understand();
}
}
class Topic {
public void understand()
{
System.out.println("Tight coupling concept");
}
}
Explanation: In the above program the Subject class is dependents on Topic class. In the above program Subject class is tightly coupled with Topic class it means if any change in the Topic class requires Subject class to change. For example, if Topic class understand() method change to gotit() method then you have to change the startReading() method will call gotit() method instead of calling understand() method.
filter_none
edit
play_arrow
brightness_4
// Java program to illustrate
// tight coupling concept
class Volume
{
public static void main(String args[])
{
Box b = new Box(5,5,5);
System.out.println(b.volume);
}
}
class Box
{
public int volume;
Box(int length, int width, int height)
{
this.volume = length * width * height;
}
}
Output:
125