It is just a requirement enforced by many Java compilers (javac included) ; it's not part of the language definition. It allows the compiler to find classes that it may need to compile while it's in the process of compiling another class. [ July 14, 2003: Message edited by: Ernest Friedman-Hill ]
Ernest is correct. This has been part of the language going all the way back to Oak. It is supposed to simplify dynamic compiling. If you are using a class in your class and that class hasn't been compiled yet, the compiler may be able to figure out where to look for it based on the source name.
Hi Ernest and Thomas, Thanx for the answers. Simon
Eric Lidell
Greenhorn
Joined: Jul 02, 2003
Posts: 20
posted
0
I thought a source(class) had to be compiled already for it to be refered or used by another class/program.when will dynamic compiling be used? can u pls give me any example code /scenario?
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
posted
0
Dynamic compiling is used by the compiler, not the JRE. If you write the following: Test1.java
Test2.java
And then run "javac Test1.java", you will discover that the compiler compiled both Test1 and Test2 classes.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Eric Lidell
Greenhorn
Joined: Jul 02, 2003
Posts: 20
posted
0
Thanks Joel. Btw,What does your motto mean?
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
posted
0
Roughly translated, it reads: "How much wood could a woodchuck chuck if a woodchuck could chuck wood?"
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
I always thought it was the following. "How much wood would a woodchuck chuck if a woodchuck could chuck wood?"