wood burning stoves*
The moose likes Beginning Java and the fly likes why .java filename constraint ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why .java filename constraint ?" Watch "why .java filename constraint ?" New topic

why .java filename constraint ?

prashant p joshi

Joined: Jul 22, 2002
Posts: 3
why .java filename must be same as public class name defined in that file?
Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
I think its because that is how the compiler finds the class files. By package and class name.

SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
It's just a convenience for the compiler.
It's one of the tricks which enable recompiling a whole Java project to be acceptably quick, without needing something like a "makefile" to tell it what to compile.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link: http://aspose.com/file-tools
subject: why .java filename constraint ?