- 论坛徽章:
- 0
|
Java provides access specifiers to allow the library creator to say that what is available to the client programmer and what is not. The levels of access control from "most access" to "least access" are public, protected, package access (which has no keyword), and private.
Package: the library unit
A package is what becomes available when you use the import keyword to bring in an entire library, such as import java.util.*;
Each compilation unit must have a name ending in .java, and inside the compilation unit there can be a public class that must have the same name as the file(including capitalizaion, but excluding the .java filename extension). There can be only one public class in each compilation unit, otherwise the compiler will complain.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8554/showart_142769.html |
|