-
PACKAGE are containers for classes.
The package is both a naming and a visibility control mechanism. -
How does the Java run-time system know where to look for packages that you create? The answer has three parts.
- First, by default, the Java run-time system uses the current working directory as its starting point. Thus, if your package is in a subdirectory of the current directory, it will be found.
- Second, you can specify a directory path or paths by setting the CLASSPATH environmental variable.
- Third, you can use the -classpath option with java and javac to specify the path to your classes.
-
When a member is declared STATIC, it can be accessed before any objects of its class are created, and without reference to any object.
You can declare both methods and variables to be static. The most common example of a static member is main( ). It is declared as static because it must be called before any objects exist.
Static method in Java is a method which belongs to the class and not to the object.