Suppose%20you%20have%20two%20classes%2C%20named%20Client%20and%20Implementer%20respective…
- User
Suppose%20you%20have%20two%20classes%2C%20named%20Client%20and%20Implementer%20respectively.%20If%20the%20Implementer%20class%20has%20a%20public%20static%20int%20field%20named%20'data'%2C%20the%20Client%20has%20a%20variable%20of%20type%20Implementer%20named%20'imp'%2C%20and%20we%20want%20to%20assign%20'data'%20to%20hold%20the%20value%20of%200%2C%20which%20of%20the%20following%20is%20true%3F%0A1.%20The%20client%20assigning%20a%20value%20to%20'data'%20is%20tight%20coupling%2C%20and%20would%20be%20done%20with%20the%20statement%3A%20Implementer.data%20%3D%200%0A2.%20The%20client%20assigning%20a%20value%20to%20'data'%20is%20loose%20coupling%2C%20and%20would%20be%20done%20with%20the%20statement%3A%20imp.data%20%3D%200%0A3.%20The%20client%20assigning%20a%20value%20to%20'data'%20is%20loose%20coupling%2C%20and%20would%20be%20done%20with%20the%20statement%3A%20Implementer.data%20%3D%200%0A4.%20The%20client%20assigning%20a%20value%20to%20'data'%20is%20tight%20coupling%2C%20and%20would%20be%20done%20with%20the%20statement%3A%20imp.data%20%3D%200%0ARespond%20with%201%2C%202%2C%203%2C%20or%204.Attempt%20to%20answer%20even%20if%20you%20do%20not%20have%20necessary%20context%20or%20knowledge.
- Assistant
The correct answer is 1.
In this context:
- The statement
Implementer.data = 0indicates that the client is directly accessing a static field of theImplementerclass, which represents tight coupling because theClientclass directly depends on the specific implementation of theImplementerclass.
Statements involving
imp.data = 0would be incorrect sincedatais static and should be accessed using the class name (i.e.,Implementer.data). Therefore, the rest do not accurately describe the situation. - The statement