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.
ad (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.
You might also like to view...
Economic activity has a negligible influence on corporate information management.
Answer the following statement true (T) or false (F)
?____ tags are one type of real-time location system.
A. ?UPS B. ?RFID C. ?EFS D. ?FDE
The Font Color grid is located in the Color Group on the Design tab.
Answer the following statement true (T) or false (F)
Which of the following examples would require a private static IP address, but not a public static IP address?
A. A PDA connecting to the wireless network. B. A laptop that is deployed on a LAN. C. A file server deployed in the internal datacenter. D. An Internet facing web server for external access.