SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Packages In Java
Packages
• Packages enable grouping of functionally related
classes
• Package names are dot separated, e.g., java.lang.
• Package names have a correspondence with the
directory structure
• Packages Avoid name space collision. There can not
be two classes with same name in a same Package
But two packages can have a class with same name.
• Exact Name of the class is identifed by its package
structure. << Fully Qualified Name>>
java.lang.String ; java.util.Arrays;
java.io.BufferedReader ; java.util.Date
How To Create a Package
• Packages are mirrored through directory
structure.
• To create a package, First we have to create
a directory /directory structure that matches
the package hierarchy.
• Package structure should match the
directory structure also.
• To make a class belongs to a particular
package include the package statement as
the first statement of source file.
Exercise Creating Packages
mypackage
mypackageBmypackageA
ABC DEG IJK XYZ
S1,S2,S3 S4,S5,S6
A,B,C D,E,F A,B,C,I,J,K X,Y,Z
Package ABC and IJK have classes with same name.
A class in ABC has name mypackage.mypackageA.ABC.A
A class in IJK has name mypackage.mypackageB.IJK.A
How to make a class Belong to a Package
• Include a proper package statement as first line in source file
Make class S1 belongs to mypackageA
package mypackage.mypackageA;
public class S1
{
public S1( )
{
System.out.println("This is Class S1");
}
} Name the source file as S1.java and
compile it and store the S1.class file in
mypackageA directory
Make class S2 belongs to mypackageA
package mypackage.mypackageA;
public class S2
{
public S2( )
{
System.out.println("This is Class S2");
}
}
Name the source file as S2.java and
compile it and store the S2.class file in
mypackageA directory
Make class A belongs to IJK
package mypackage.mypackageB.IJK;
public class A
{
public A( )
{
System.out.println("This is Class A in IJK");
}
}
Name the source file as A.java and compile
it and store the A.class file in IJK directory
<< Same Procedure For all classes>>
Importing the Package
• import statement allows the importing of package
• Library packages are automatically imported
irrespective of the location of compiling and executing
program
• JRE looks at two places for user created packages
(i) Under the current working directory
(ii) At the location specified by CLASSPATH
environment variable
• Most ideal location for compiling/executing a program
is immediately above the package structure.
Example importing
import mypackage.mypackageA.ABC;
import mypackage.mypackageA.ABC.*;
class packagetest
{
public static void main(String args[])
{
B b1 = new B();
C c1 = new C();
}
}
This is Class B
This is Class C
<< packagetest.java>>
<< Store it in location above the package
structure. Compile and Execute it from
there>>
import mypackage.mypackageA.ABC.*;
Import mypackage.mypackageB.IJK.*;
class packagetest
{
public static void main(String args[])
{
A a1 = new A();
}
}
<< What’s Wrong Here>>
<< class A is present in both the imported
packages ABC and IJK. So A has to be fully
qualified in this case>>
mypackage.mypackageA.ABC.A a1 = new mypackage.mypackageA.ABC.A();
OR
mypackage.mypackageB.IJK.A a1 = new mypackage.mypackageB.IJK.A();
CLASSPATH Environmental Variables
• CLASSPATH Environmental Variable lets you define
path for the location of the root of the package
hierarchy
• Consider the following statement :
package mypack;
What should be true in order for the
program to find mypack.
(i) Program should be executed from the location
immediately above mypack
OR
(ii) mypack should be listed in the set of directories
for CLASSPATH

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Packages in java
Packages in javaPackages in java
Packages in java
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
L21 io streams
L21 io streamsL21 io streams
L21 io streams
 
Package in Java
Package in JavaPackage in Java
Package in Java
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Java packages
Java packagesJava packages
Java packages
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Java program structure
Java program structureJava program structure
Java program structure
 
Files in java
Files in javaFiles in java
Files in java
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python libraries
 
Packages,static,this keyword in java
Packages,static,this keyword in javaPackages,static,this keyword in java
Packages,static,this keyword in java
 
OOP java
OOP javaOOP java
OOP java
 
Chapter 07 inheritance
Chapter 07 inheritanceChapter 07 inheritance
Chapter 07 inheritance
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
 

Andere mochten auch

Packages and inbuilt classes of java
Packages and inbuilt classes of javaPackages and inbuilt classes of java
Packages and inbuilt classes of javakamal kotecha
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiersashishspace
 
Built in classes in java
Built in classes in javaBuilt in classes in java
Built in classes in javaMahmoud Ali
 
5.interface and packages
5.interface and packages5.interface and packages
5.interface and packagesDeepak Sharma
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singhdheeraj_cse
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiersasbasb82
 
Access Protection
Access ProtectionAccess Protection
Access Protectionmyrajendra
 
Java - Exception Handling
Java - Exception HandlingJava - Exception Handling
Java - Exception HandlingPrabhdeep Singh
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classesShreyans Pathak
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in javaPratik Soares
 
Java exception handling
Java exception handlingJava exception handling
Java exception handlingBHUVIJAYAVELU
 
Java exception handling ppt
Java exception handling pptJava exception handling ppt
Java exception handling pptJavabynataraJ
 

Andere mochten auch (20)

Java packages
Java packagesJava packages
Java packages
 
Packages and inbuilt classes of java
Packages and inbuilt classes of javaPackages and inbuilt classes of java
Packages and inbuilt classes of java
 
java packages
java packagesjava packages
java packages
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiers
 
Java packages oop
Java packages oopJava packages oop
Java packages oop
 
Built in classes in java
Built in classes in javaBuilt in classes in java
Built in classes in java
 
5.interface and packages
5.interface and packages5.interface and packages
5.interface and packages
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiers
 
Access Protection
Access ProtectionAccess Protection
Access Protection
 
Java - Exception Handling
Java - Exception HandlingJava - Exception Handling
Java - Exception Handling
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Java exception handling ppt
Java exception handling pptJava exception handling ppt
Java exception handling ppt
 
Core java slides
Core java slidesCore java slides
Core java slides
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Webquest
WebquestWebquest
Webquest
 
Java package
Java packageJava package
Java package
 

Ähnlich wie Packages in Java - Group Classes and Avoid Namespaces

Ähnlich wie Packages in Java - Group Classes and Avoid Namespaces (20)

Javapackages 4th semester
Javapackages 4th semesterJavapackages 4th semester
Javapackages 4th semester
 
packages unit 5 .ppt
packages  unit 5 .pptpackages  unit 5 .ppt
packages unit 5 .ppt
 
packages.ppt
packages.pptpackages.ppt
packages.ppt
 
packages.ppt
packages.pptpackages.ppt
packages.ppt
 
Java packages
Java packagesJava packages
Java packages
 
Packages
PackagesPackages
Packages
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Packages
PackagesPackages
Packages
 
9 cm604.26
9 cm604.269 cm604.26
9 cm604.26
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
Packages(9 cm604.26)
Packages(9 cm604.26)Packages(9 cm604.26)
Packages(9 cm604.26)
 
7.Packages and Interfaces(MB).ppt .
7.Packages and Interfaces(MB).ppt             .7.Packages and Interfaces(MB).ppt             .
7.Packages and Interfaces(MB).ppt .
 
Package.pptx
Package.pptxPackage.pptx
Package.pptx
 
packages.ppt
packages.pptpackages.ppt
packages.ppt
 
THE PACKAGES CONCEPT IN JAVA PROGRAMMING.pptx
THE PACKAGES CONCEPT  IN JAVA PROGRAMMING.pptxTHE PACKAGES CONCEPT  IN JAVA PROGRAMMING.pptx
THE PACKAGES CONCEPT IN JAVA PROGRAMMING.pptx
 
Java Packages
Java Packages Java Packages
Java Packages
 
Lecture-12 Java Packages and GUI Basics.ppt
Lecture-12 Java Packages and GUI Basics.pptLecture-12 Java Packages and GUI Basics.ppt
Lecture-12 Java Packages and GUI Basics.ppt
 

Mehr von Abhishek Khune (16)

07 java collection
07 java collection07 java collection
07 java collection
 
Clanguage
ClanguageClanguage
Clanguage
 
Java Notes
Java NotesJava Notes
Java Notes
 
Threads
ThreadsThreads
Threads
 
Sorting
SortingSorting
Sorting
 
Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01
 
Week0 introduction
Week0 introductionWeek0 introduction
Week0 introduction
 
Binary trees
Binary treesBinary trees
Binary trees
 
Applets
AppletsApplets
Applets
 
Clanguage
ClanguageClanguage
Clanguage
 
06 abstract-classes
06 abstract-classes06 abstract-classes
06 abstract-classes
 
Java unit3
Java unit3Java unit3
Java unit3
 
Java unit2
Java unit2Java unit2
Java unit2
 
Linux introduction
Linux introductionLinux introduction
Linux introduction
 
Shared memory
Shared memoryShared memory
Shared memory
 
Lecture 14 (inheritance basics)
Lecture 14 (inheritance basics)Lecture 14 (inheritance basics)
Lecture 14 (inheritance basics)
 

Kürzlich hochgeladen

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Kürzlich hochgeladen (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Packages in Java - Group Classes and Avoid Namespaces

  • 2. Packages • Packages enable grouping of functionally related classes • Package names are dot separated, e.g., java.lang. • Package names have a correspondence with the directory structure • Packages Avoid name space collision. There can not be two classes with same name in a same Package But two packages can have a class with same name. • Exact Name of the class is identifed by its package structure. << Fully Qualified Name>> java.lang.String ; java.util.Arrays; java.io.BufferedReader ; java.util.Date
  • 3. How To Create a Package • Packages are mirrored through directory structure. • To create a package, First we have to create a directory /directory structure that matches the package hierarchy. • Package structure should match the directory structure also. • To make a class belongs to a particular package include the package statement as the first statement of source file.
  • 4. Exercise Creating Packages mypackage mypackageBmypackageA ABC DEG IJK XYZ S1,S2,S3 S4,S5,S6 A,B,C D,E,F A,B,C,I,J,K X,Y,Z Package ABC and IJK have classes with same name. A class in ABC has name mypackage.mypackageA.ABC.A A class in IJK has name mypackage.mypackageB.IJK.A
  • 5. How to make a class Belong to a Package • Include a proper package statement as first line in source file Make class S1 belongs to mypackageA package mypackage.mypackageA; public class S1 { public S1( ) { System.out.println("This is Class S1"); } } Name the source file as S1.java and compile it and store the S1.class file in mypackageA directory
  • 6. Make class S2 belongs to mypackageA package mypackage.mypackageA; public class S2 { public S2( ) { System.out.println("This is Class S2"); } } Name the source file as S2.java and compile it and store the S2.class file in mypackageA directory
  • 7. Make class A belongs to IJK package mypackage.mypackageB.IJK; public class A { public A( ) { System.out.println("This is Class A in IJK"); } } Name the source file as A.java and compile it and store the A.class file in IJK directory << Same Procedure For all classes>>
  • 8. Importing the Package • import statement allows the importing of package • Library packages are automatically imported irrespective of the location of compiling and executing program • JRE looks at two places for user created packages (i) Under the current working directory (ii) At the location specified by CLASSPATH environment variable • Most ideal location for compiling/executing a program is immediately above the package structure.
  • 9. Example importing import mypackage.mypackageA.ABC; import mypackage.mypackageA.ABC.*; class packagetest { public static void main(String args[]) { B b1 = new B(); C c1 = new C(); } } This is Class B This is Class C << packagetest.java>> << Store it in location above the package structure. Compile and Execute it from there>>
  • 10. import mypackage.mypackageA.ABC.*; Import mypackage.mypackageB.IJK.*; class packagetest { public static void main(String args[]) { A a1 = new A(); } } << What’s Wrong Here>> << class A is present in both the imported packages ABC and IJK. So A has to be fully qualified in this case>> mypackage.mypackageA.ABC.A a1 = new mypackage.mypackageA.ABC.A(); OR mypackage.mypackageB.IJK.A a1 = new mypackage.mypackageB.IJK.A();
  • 11. CLASSPATH Environmental Variables • CLASSPATH Environmental Variable lets you define path for the location of the root of the package hierarchy • Consider the following statement : package mypack; What should be true in order for the program to find mypack. (i) Program should be executed from the location immediately above mypack OR (ii) mypack should be listed in the set of directories for CLASSPATH