Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Empty file

 
Jay Kay
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Manfred.
 
Jay Kay
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more doubt:
So a source file is one which can be compiled but not be executed?
Thanks.
-Jay
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jay,
you can execute a public class declared in a source file. The source file name must be classname.java
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic