This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 11150
    
  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
 
jQuery in Action, 2nd edition
 
subject: only 1 public class per source file
 
Similar Threads
source file?
Public class
Class using Main without declaring itself Public
Abstract class
Why should there be only one public class per source file