| Author |
what does this line mean..(Defining Packages)
|
madhup narain
Ranch Hand
Joined: Dec 14, 2004
Posts: 148
|
|
I was reading about packages and i came across this statement
The package name is saved in the java byte code for the types contained in the package.
Please could someone explain
|
Money for nothing and Java for Free
SCJP, SCWCD
|
 |
vijaya bharath
Ranch Hand
Joined: Jun 10, 2005
Posts: 66
|
|
Hi, Iam not sure that this is the correct explanation for your question but i understood like this the line says quote: -------------------------------------------------------------------------------- The package name is saved in the java byte code for the types contained in the package. -------------------------------------------------------------------------------- Class we have defined can say as new data type that is object is the variable of the class datatype. So i think this line means package is contains so many datatypes that is classes. How we can access the class in a package by specifying like this package.classname right! so here package name is using to access the userdefined data type that is class. That package name JVM stores it in byte code. I think u got some thing.
|
Regards,<br />Vijaya Bharath.<br />SCJP1.4 <br />SCWCD5.0
|
 |
madhup narain
Ranch Hand
Joined: Dec 14, 2004
Posts: 148
|
|
wasnt able to understand an iota ... Reagards
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
First of all, the "types contained in the package" refers to interfaces and classes that are declared in a package. The "byte code" refers to the data that is stored in the .class file that you get when you compile a .java file that contains such a class or interface. So say you have a class named MyClass with the source code in a file named MyClass.java. Also, you declare MyClass to be in the package mypackage. When you compile MyClass.java, javac generates a file named MyClass.class. Somewhere in this file, the compiler stores the package name (i.e. mypackage). I am willing to bet that somewhere in Sun's documentation, it specifies the exact location of the package name in the .class file. HTH Layne
|
Java API Documentation
The Java Tutorial
|
 |
 |
|
|
subject: what does this line mean..(Defining Packages)
|
|
|