Module 4: GETTER AND SETTER Flashcards
1
Q
Are two conventional methods that are used for retrieving and updating value of a variable.
A
getter and setter
2
Q
The naming scheme of setter and getter should follow Java bean naming convention as follows:
A
getXXX() and setXXX()
3
Q
- If the variable is of type boolean, then the getter’s name can be either isXXX() or getXXX(), but the former naming is preferred. For example:
A
private boolean single;
public String isSingle() {}
4
Q
setter and getter method for int quantity
A
getQuantity() setQuantity(int qty)
5
Q
setter and getter method for String firstName
A
getFirstName() setFirstname (String fname)
6
Q
setter and getter method for boolean rich
A
isRich() getRich(), setRich(boolean rich)