it depends on the JVM version, for example: a1.4 JVM won't run a .java file compiled by a1.6 compiler unless you use compilation flags as follows:
in you console you can try this
% javac -target1.4 -bootclasspath jdk1.4.2/lib/classes.zip \
-extdirs "" OldCode.java
-target : tells the used compiler to generate code that will run on an older JVM.
-bootclasspath : compile your code against the APIs of the older version of Java.
for more information of using 'javac' command, see it's documentation on http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javac.html