![]() ![]() An entity without access control modifier (i.e., default) is accessible by classes in the same package only. A protected entity is accessible by classes in the same package and its subclasses. Access Control: Besides public and private, Java has two access control modifiers – protected and default – that are related to package.This mechanism is called Namespace Management. These two classes can be used in the same program and distinguished using the fully-qualified class name - package name plus class name. Although they share the same class name Circle, but they belong to two different packages: com.zzz and com.yyy. For example, and are two distinct classes. Resolving naming conflict of classes by prefixing the class name with a package name. ![]() PackageĪ package is a collection of related Java entities (such as classes, interfaces, exceptions, errors and enums). Java 9 introduces a higher level of structure called "module" on top of "package". This article is applicable to pre-Java 9. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |