This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Empty java file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Empty java file" Watch "Empty java file" New topic
Author

Empty java file

mahesh ogale
Greenhorn

Joined: Jan 14, 2004
Posts: 8
Why empty java file gets compiled correctly if it is the requirement that filename should match class name which contains main method?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
It's required that any public outer class defined in a source file matches the name of the file.
That the main method should be in a public class defined in a source file of the same name is nothing to do with whether every source file should have a matching public class defined, or any class defined at all. Though, if the source file doesn't define any classes, then it's not much use really.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Empty java file
 
Similar Threads
A Beginner Question?
Hi, All SCJP Candidate help me
Java 1.6 very slow compared to 1.5- Reason
empty file
Unable to open Applet in Firefox/Mozilla