This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Is empty file is valid java source file? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Is empty file is valid java source file?" Watch "Is empty file is valid java source file?" New topic
Author

Is empty file is valid java source file?

Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1803
I have read in one book,that is Is empty source file a valid java source file?The answer they gave is yes.I could not get the right explanation.
i don'y know what they mean.withot interface,class,package,import how can a file will be a valid source file?
Its confusing me.


Krishna Srinivasan
OCAJP Mock Questions
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
If you browse to JLS 7.3: Compilation Units, you will see that a compilation unit (i.e., a Java source file) is composed of three high level elements, called PackageDeclaration, ImportDeclarations, and TypeDeclarations. All of them are optional, which clearly means that an empty compulation unit is a valid java file.
I hope this clears your doubts.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Is empty file is valid java source file?
 
Similar Threads
Empty file
A Beginner Question?
Hi, All SCJP Candidate help me
Compiling a blank file??
empty file