0
class A { private int x; public ??? getX() { return ??? ; } public ??? setX(int x) { this.x = x; } }
what will be at the place of ???.Question of Getter and Setter
2 Réponses
+ 3
Some hints:
1. return type of getX should be equal to the type of x
2. getX should return the value of x.
3. A setter method usually doesn't return a value. There is a special keyword for 'no return value'.
If these don't help you, I recommend to repeat some lessons of the course .
0
int, x, void