Originally posted by You Lu:
the code below is failed to compile.
import java.io.*;
package testpackage;
public class Test{// do something...}
Because this is a rule mentioned in the
java specification and so the javac compiler has to follow the specs. and obey. You can't have forward referencing for package declaration but you may have forward referencing for non-public classes/interfaces in your java file.