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
public void getX(int x)
B
public void getX()
C
private int getX()
D
public int getX()
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #2 | y.seong2027 | 1 | 2 | 8m 33s | -423 |
| #3 | bommasam000 | 4 | 4 | 37m 37s | -1,857 |
Items per page:
10
1 – 3 of 3
APFIVE