Card 40 / 76: If a constructor does not include an access modifier, which modifier will it use by default?
A)
A constructor that does not include an access modifier will always be declared as public.
B)
A constructor that does not include an access modifier will make use of the same access modifier that is used for its class.
C)
A compilation error will occur if a constructor does not include an access modifier.
Answer:
B) A constructor that does not include an access modifier will make use of the same access modifier that is used for its class.
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
A and C are incorrect.
A is incorrect because constructors that do not include an access modifier are not always declared as public; they are declared the same as their class.
C is incorrect because a compilation error will not occur if a constructor does not have an access modifier.
|