Which of the following statements is false?
a. You cannot prevent client code from creating objects of a class.
b. One common use of a private constructor is sharing initialization code among a class’s other constructors.
c. Another common use of private constructors is to force client code to use so-called “factory methods” to create objects.
d. A factory method is a public static method that creates and initializes an object of a specified type (possibly of the same class), then returns a reference to it.
a. You cannot prevent client code from creating objects of a class. Actually. you can prevent client code from creating objects of a class by making the class’s constructors private.
You might also like to view...
One way to ________ coworkers is to send or receive a file that is attached to an email
A) get along with B) collaborate with C) avoid D) win over
When you ________, you insert a copy of an item stored in the Office Clipboard into the document
A) copy B) save C) paste D) cut