javaPackage - which we put in the next directory above that...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
A package is the Java version of a library . A package refers simply to a group of related class files in the same directory and having in each class file a package directive with that directory name at the top of the file. For example, say that we put the file into the directory java , which is a subdirectory of current directory – we will name it assignment . So your directory tree in your file system looks like the following: C:\ …… …… assignment (Your current directory, resides) java (Your package directory, is here) At the top of file we put the statement package java; We use this package with
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: which we put in the next directory above that of the package java. We put the import statement as the first statement in your program: import java.*; You don’t need to compile the program first. When you compile your program which uses the java package, the compiler will look for a sub-directory named java in the current directory holding program. When the compiler finds the file and it has not been compiled, it will do the compilation for you automatically. By convention package names begin with a lower case letter, while classes begin with an upper case letter....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online