wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes only 1 public class per source 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 "only 1 public class per source file" Watch "only 1 public class per source file" New topic
Author

only 1 public class per source file

shivam aggarwal
Greenhorn

Joined: Oct 15, 2009
Posts: 8
we can have only 1 public class per source file and that source file must be named (name of public class.java).why?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

because it makes implementing the JVM easier.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: only 1 public class per source file
 
Similar Threads
Why should there be only one public class per source file
source file?
Public class
Class using Main without declaring itself Public
Abstract class