What is the default access specifier in Java?

The default visibility is known as “package-private” (though you can’t use this explicitly), which means the field will be accessible from inside the same package to which the class belongs.

As mdma pointed out, it isn’t true for interface members though, for which the default is “public”.

See Java’s Access Specifiers

Leave a Comment