File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes import statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "import statement" Watch "import statement" New topic

import statement

pasaris sirasap

Joined: Feb 13, 2005
Posts: 1
how do i make my group of classes be imported to my program ? whats the procedure for that
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
If your classes are not in a named package, just put them in the same directory that has the class named in the javac command or a directory named in your classpath.

If packages are involved, the first identifier in the package name should be a subdirectory either in the same directory as the file named in your javac command or a directory in your classpath. If there are other identifiers in the package name, create subdirectories downward from the first subdirectory. Store your class or interface source file in the lowest of these subdirectories.

You can refer to members of packages either by putting the full package name in front of the class or interface name every time you use it or with an import statement. References within the same package can just use the simple name.

You can look up the format and placement of package and import statements.

[ February 14, 2005: Message edited by: Mike Gershman ]
[ February 14, 2005: Message edited by: Mike Gershman ]

Mike Gershman
SCJP 1.4, SCWCD in process
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 166
Hi Pasaris,
I don't know how I got the feeling that you're not using your real name.

yosi isoy
I agree. Here's the link:
subject: import statement
It's not a secret anymore!