detaild steps to create package

1
Detaild steps to create package 1. Create a folder with a suitable name which will be the name of your package (suppose mypackage) 2. Now write a program (suppose myclass.java) in your java editor (i.e. notepad) and save it in your above created folder (mypackage) 3.Write a statement in your above program file (myclass.java) which must be first line in your above program which is given as: package your_folder_name; 4. NOTE: your package name and folder or directory name must be same 5. Now compile your program using javac compiler 6. If your package and your program file are in same directory (i.e. are sibling) a. Import your package and use it 7. If your package and your program file are at\in different locations\folders then a. Set class path using the following command :- set classpath = .;path of your package; b. Import your package and use it

Upload: govind-upadhyay

Post on 25-Dec-2015

6 views

Category:

Documents


0 download

DESCRIPTION

packages

TRANSCRIPT

Page 1: Detaild Steps to Create Package

Detaild steps to create package

1. Create a folder with a suitable name which will be the name of your package (suppose

mypackage)

2. Now write a program (suppose myclass.java) in your java editor (i.e. notepad) and

save it in your above created folder (mypackage)

3. Write a statement in your above program file (myclass.java) which must be first line

in your above program which is given as:package your_folder_name;

4. NOTE: your package name and folder or directory name must be same

5. Now compile your program using javac compiler

6. If your package and your program file are in same directory (i.e. are sibling)

a. Import your package and use it

7. If your package and your program file are at\in different locations\folders then

a. Set class path using the following command :-

set classpath = .;path of your package;

b. Import your package and use it