This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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 Make it so: Java DB Connections & Transactions this week in the JDBC 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="" target="_blank" rel="nofollow"></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 ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: why .java filename constraint ?
It's not a secret anymore!