Which method names follow the JavaBeans standard? (Choose all that apply.)

  1. addSize

  2. getCust

  3. deleteRep

  4. isColorado

  5. putDimensions


Correct Option: B,D

AI Explanation

To answer this question, we need to understand the JavaBeans standard. The JavaBeans standard is a design pattern for writing reusable and customizable components in Java. According to this standard, the names of methods in JavaBeans should follow specific conventions.

Let's go through each option to determine if it follows the JavaBeans standard:

A. addSize - This method name does not follow the JavaBeans standard. According to the standard, getter and setter methods should have names that start with "get" and "set" respectively.

B. getCust - This method name follows the JavaBeans standard. It starts with "get" and is followed by a capitalized property name ("Cust"). This naming convention is used for getter methods.

C. deleteRep - This method name does not follow the JavaBeans standard. According to the standard, getter and setter methods should have names that start with "get" and "set" respectively.

D. isColorado - This method name follows the JavaBeans standard. It starts with "is" and is followed by a capitalized property name ("Colorado"). This naming convention is used for boolean getter methods.

E. putDimensions - This method name does not follow the JavaBeans standard. According to the standard, getter and setter methods should have names that start with "get" and "set" respectively.

Therefore, the method names that follow the JavaBeans standard are B. getCust and D. isColorado.

Find more quizzes: