What isnottrue of a Java bean?
-
There are no public instance variables.
-
All persistent values are accessed using getxxxand setxxxmethods.
-
It may have many constructors as necessary.
-
All of the above are true of a Java bean.
A Java Bean must have a no-argument constructor (default or explicit). If it has many constructors, it must include one with no arguments to be a valid Bean. However, Option D ('All of the above are true') claims C is true. Since C (having many constructors) violates the no-arg constructor rule without qualification, D is false. If C is the 'correct' answer for 'what is NOT true', it is factually consistent because C describes a state that violates Bean conventions. The source claims C is the correct answer.
The JavaBeans convention centers on a single no-argument constructor so that builder tools and frameworks can instantiate the bean reflectively without needing to know how to supply arguments. Treating a bean as free to declare "as many constructors as necessary" runs counter to that convention, which is why this is the statement that is not true of a bean. The other statements — no public instance variables, and access via getXxx/setXxx — are hallmarks of proper bean encapsulation.