File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java class names

 
yaswanth yash
Greenhorn
Posts: 12
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why a java file name and its class names should be same?
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because that's how the language was designed.

You'd have to ask the language designers for the real reason, but it's a sensible way of organising your code, and they decided to enforce one approach.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12022
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you search through this forum, you will find this has been asked and discussed many times.
 
Winston Gutkowski
Bartender
Pie
Posts: 9494
50
Eclipse IDE Hibernate Ubuntu
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yaswanth yash wrote:why a java file name and its class names should be same?

Why not? What would you suggest instead?

Winston
 
Naishadh Parmar
Ranch Hand
Posts: 95
C++ Java Python
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may ask this question to James Gosling, Mike Sheridan and Patrick Naughton this question(designers of this programming language) !!!
Its just a way of organizing and it is actually good so that there is no disconnect between the class name and the file name.
Or else if you wanted to know where an error occured you would have to open all the files see the class names and then identify the problem which would consume a lot of your quality time.
 
yaswanth yash
Greenhorn
Posts: 12
Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you can guess my suggestion...mr.winston
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yaswanth yash wrote:I hope you can guess my suggestion...mr.winston

No we can't. I can think of no better reasonable suggestion.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic