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

26th Aug 2017, 6:57 PM
Gopi Krishna Verma
Gopi Krishna Verma - avatar
2 Answers
+ 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 .
26th Sep 2017, 9:40 PM
Tashi N
Tashi N - avatar
0
int, x, void
2nd Dec 2020, 11:31 AM
Sivaranjani S
Sivaranjani S - avatar