0

What is the visibility of a default constructor in Java11? This is different from what is the default visibility of a constructor.

Bozidar D
  • 23
  • 2

1 Answers1

7

The visibility of the default constructor depends on the access modifier of the class, as stated in the java specification Chapter 8. Classes - 8.8.9. Default Constructor:

The default constructor has the same access modifier as the class, unless the class lacks an access modifier, in which case the default constructor has package access (§6.6).

Progman
  • 13,123
  • 4
  • 28
  • 43