Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is not true of a Java bean?

  • A.There are no public instance variables.
  • B.All persistent values are accessed using getxxx and setxxx methods.
  • C.It may have many constructors as necessary.
  • D.All of the above are true of a Java bean.

Answer: C

Correct answer: It may have many constructors as necessary.

A bean must provide a public constructor taking no arguments, because the container creates it by reflection and has no arguments to supply. Additional constructors may exist, but the no-argument one is obligatory, so the statement as written is not true of a bean. The other two - no public instance variables, access through get and set methods - are the other defining requirements.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.