aspose file tools*
The moose likes Beginning Java and the fly likes Why one public 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 one public class " Watch "Why one public class " New topic
Author

Why one public class

Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Hello friends!!!
I want to know why there is only one public class in a .java file?
and Why the name of file must be the name of public class


Life is easy because we write the source code.....
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

Because that's just how the Java language was designed. There really isn't any more special reason to it.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38788
    
  23
Welcome to JavaRanch
It has to do with the compiler finding the class details more quickly. This older thread has more details in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why one public class