• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why one public class  RSS feed

 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because that's just how the Java language was designed. There really isn't any more special reason to it.
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
It has to do with the compiler finding the class details more quickly. This older thread has more details in.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!