Multiple choice technology programming languages

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

  1. getCust

  2. isColorado

  3. addSize

  4. putDimensions

Reveal answer Fill a bubble to check yourself
A,B Correct answer
Explanation

JavaBeans getter naming: boolean properties use 'is' prefix (isColorado), other types use 'get' prefix (getCust). The method must be public and non-void. addSize and putDimensions don't follow getter patterns - add suggests collection manipulation, put is not a valid prefix.

AI explanation

To answer this question, we need to understand the JavaBeans standard. The JavaBeans standard is a set of naming conventions for methods in Java classes that are used to represent properties.

Let's go through each option to determine which ones follow the JavaBeans standard:

Option A) getCust - This method follows the JavaBeans standard. The prefix "get" indicates that this method is used to retrieve the value of a property called "cust".

Option B) isColorado - This method also follows the JavaBeans standard. The prefix "is" is used for boolean properties, and "Colorado" is the name of the property.

Option C) addSize - This method does not follow the JavaBeans standard. The prefix "add" is typically used for methods that add elements to a collection or perform some kind of addition operation.

Option D) putDimensions - This method does not follow the JavaBeans standard. The prefix "put" is typically used for methods that add or update elements in a map or dictionary.

Therefore, the correct options that follow the JavaBeans standard are A) getCust and B) isColorado.