Which, when inserted at line 13, allows another class to get the value of the salary variable, but NOT change the value of the salary variable?

Given:
11. public class Employee {
12. public String name;
13. // insert code here
14.
15. public String getName() {
16. return name;
17. }
18.
19. public int getSalary() {
20. return salary;
21. }
22. }
Which, when inserted at line 13, allows another class to get the value of the salary variable, but
NOT change the value of the salary variable?

Given:
11. public class Employee {
12. public String name;
13. // insert code here
14.
15. public String getName() {
16. return name;
17. }
18.
19. public int getSalary() {
20. return salary;
21. }
22. }
Which, when inserted at line 13, allows another class to get the value of the salary variable, but
NOT change the value of the salary variable?

A.
readOnly int salary;

B.
secure int salary;

C.
private int salary;

D.
public int salary;

E.
hidden int salary;



Leave a Reply 0

Your email address will not be published. Required fields are marked *