This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line! See this thread for details.
no its just a package like the others. if u dont put a package definition in a code, the classes in this file will be thrown into the default package. this package contains all classes like this.so classes which are not specified with a package are treated as in same package, the default package.
Originally posted by Jay Kay: If a package name is not specified for the class, the class will be placed in a "default" package. Where does this default package reside and what does it contain? Is it garbage collected? Any help is greatly appreciated. Thank you. -Jay
Hi Jay Great boss has given answer for garbage collection.. so no more words after that.. The default package is your directory where you are placing your class file. So what is the need of package?? If I want to use your class then I have place my .java file in the same folder where is your class file else i won't be able to use that class. And also if i want to run your file then again i have to go to your directory where u have placed class file. package is a way to arrange your classes, to make easier access and to avoid name collision, as directory structure is to arrange your files. (when i was novice then i used to think what is the use of CD, MKDIR (dos commands), why to make directory? now on my disk by the directory name i can tell which files willbe there. so it takes time... to understand proper use of some good things) CMIW ------------------ Regards Ravish
"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
You could consider that there is default package in each directory in which a Java application is launched. This package contains all the Java classes that reside in this directory and their sources has no package sentence. In each directory also a named package could exist. Please use the default package only for litle programs that you are not going to distribute or testing litle programs. Please never tries to mix both types of packages, though possible it is of no use at all. Remember that Sun encourages us to use named packages for any real program.
SCJP2. Please Indent your code using UBB Code
posted 18 years ago
Awesome. Thanks guys. -Jay
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...