Asked by Mathew Temisan on Jun 11, 2024

verifed

Verified

A _________ can occur if a programmer allows an accessor method to return a reference to an array instance variable.

A) short circuit
B) privacy leak
C) partially filled array
D) syntax error

Privacy Leak

A situation where sensitive information is disclosed unintentionally or without authorization.

Accessor Method

In object-oriented programming, a method that is used to read data fields of an object without altering them.

  • Be aware of the security and privacy concerns related to arrays, such as privacy leaks.
verifed

Verified Answer

NR
Nicki RayneJun 13, 2024
Final Answer :
B
Explanation :
A privacy leak occurs when a programmer allows direct access to an object's instance variables or return a reference to an object's instance variables. In this case, if an accessor method returns a reference to an array instance variable, the caller of the method can modify the contents of the array directly, which can lead to unintended consequences and can violate the object's encapsulation.