December 17, 2009

Quick-reference table of Java access modifiers

The table on this page lists the differences between public, protected, package-protected — AKA no modifier — and private fields in Java:

ModifierClassPackageSubclassWorld
publicYYYY
protectedYYYN
[no modifier]YYNN
privateYNNN


Source: http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html

Terms for easy searching later:
package-private, package-protected, access control, public, protected, private

No comments:

Post a Comment