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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 13872
    
  10

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: 36478
    
  16
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
 
Similar Threads
Error message concerning public modifier
Source File declaration rule in java
Name of java file with public class
source file?
public class