Multiple choice technology programming languages

The access modifier of default constructor is not same as class modifier

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The default constructor's access modifier IS the same as the class modifier. If the class is public, the default constructor is public. If the class has package-private access, the default constructor is also package-private. This ensures the constructor is accessible wherever the class itself is accessible.

AI explanation

When the Java compiler generates a default (no-arg) constructor because none was explicitly written, that constructor's access level always matches the class's own access modifier — a public class gets a public default constructor, a package-private class gets a package-private one. So the statement is False, not True.