l

Bean Introspection  «Prev 

Property Design - Exercise Result

You Said:

Using Property Design Patterns - Results

View the diagram below containing the boxed lines of code to obtain descriptions of the code content.

getter() and setter() methods for the JavaBean
getter() and setter() methods for the JavaBean
  1. The getter method for|the numLegs property.
  2. The setter method for|the numLegs property.
  3. The getter method for|the insect property.
  4. The setter method for|the insect property.

Text Version:

1:  public int getNumLegs() {
2:    return numLegs;
3:  }
4:
5:  public void setNumLegs(int nl) {
6:    numLegs = nl;
7:  }
8:
9:  public boolean isInsect() {
10:   return insect;
11: }
12:
13: public void setInsect(boolean i) {
14:   insect = i;
15: }

  1. Lines 1-3: The getter method for the numLegs property
  2. Lines 5-7: The setter method for the numLegs property
  3. Lines 9-11: The getter method for the insect property
  4. Lines 13-15: The setter method for the insect property