Accessor Method Header
Consider the following class definition.
public class Example
{
private int x;
// Constructor not shown.
}
Which of the following method headers, if added to the Example class, would allow other classes to access the value of the private instance variable x?
A
private int getX()
B
public void getX()
C
public int getX()
D
public void getX(int x)
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE