This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Empty file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Empty file" Watch "Empty file" New topic
Author

Empty file

Jay Kay
Ranch Hand

Joined: May 17, 2001
Posts: 58
Any empty file is a valid source file. How come? How can it be a valid source file if I cannot compile it.
Any help is greatly appreciated.
-Jay
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Jay,
An empty file can always be compiled. It will produce no errors because there is no code to generate any!
An empty file, however will not generate a class file so it can not be exectued.
Regards,
Manfred.
Jay Kay
Ranch Hand

Joined: May 17, 2001
Posts: 58
Thanks Manfred.
Jay Kay
Ranch Hand

Joined: May 17, 2001
Posts: 58
One more doubt:
So a source file is one which can be compiled but not be executed?
Thanks.
-Jay
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
Jay,
you can execute a public class declared in a source file. The source file name must be classname.java
Dan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Empty file