Which of the following statements are true?

a. A class should describe a single entity and all the class operations should logically fit together to support a coherent purpose.
b. A class should always contain a no-arg constructor.
c. The constructors must always be public.
d. The constructors may be protected.

a. A class should describe a single entity and all the class operations should logically fit together to support a coherent purpose.
d. The constructors may be protected.
(B) is not true. Most classes have a no-arg constructor. But sometimes, it does not make any sense to provide a no-arg constructor. For example, StringTokenizer does not have a no-arg constructor. (C) is not true. For example, the constructor in the Math class is private to prevent creating instances from the class, because there is no need to create instances for the Math class since all methods are static in Math. The constructors for abstract classes should be protected in most cases.

Computer Science & Information Technology

You might also like to view...

After verifying the system is operating, you need to document the solution.Typically, you do this with a(n) ________management system

a. Solution b. Incident c. Flow chart d. None of the above

Computer Science & Information Technology

?The _________ property value offixedtells the browser to ignore cell content when reducing the width of the table columns.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology