OCA Java SE 8 Method - OCA Mock Question Method 23


Which are methods using JavaBeans naming conventions for accessors and mutators?

  1. public boolean getCanTalk()
  2. public boolean canTalk()
  3. public int getNumWings()
  4. public int numWings()
  5. public void setCanTalk(boolean b)


C, E.


A is incorrect. For boolean and getters must begin with is for booleans.

B and D are incorrect because they don't follow the naming convention of beginning with get/is/set.

C and E follow normal getter and setter conventions.