File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes why public class should be stored in same filename as of class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why public class should be stored in same filename as of class?" Watch "why public class should be stored in same filename as of class?" New topic
Author

why public class should be stored in same filename as of class?

Nancy Antony
Ranch Hand

Joined: Sep 06, 2007
Posts: 145

Hi Ranchers,

I'd like to know why .java file should have same name as of public class ?

Nancy
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

Have a look at this post. It's your java platform that decides whether this is enforced or not.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Imagine the nightmare of trying to find a class' source file if you could name it anything you wanted... (without using an IDE that is.) Some one could save the "AccountInformation" class in a file named "FileSystemDeleteMechanism.java". And believe me, there are people that would do such crazy things if Java didn't prevent it. To me, it just one of those common sense rules they put into Java. And I for one am glad it is there.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why public class should be stored in same filename as of class?