• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why one public class

 
Pramod P Deore
Ranch Hand
Posts: 632
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
Saloon Keeper
Posts: 15205
36
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
Sheriff
Posts: 48374
56
  • 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