Best of all you look at this Oracle article: Java SE 7 and JDK 7 Compatibility
A small copied paste from the article:
Source Compatibility
Java SE 7 includes new language features and API platforms. If they are used in the source file, this source file cannot be compiled on an earlier version of the Java platform.
In general, a source code compatibility policy is to avoid source code incompatibility.
Deprecated APIs are interfaces that are only supported for compatibility with previous versions. The javac compiler generates a warning message when one of them is used, if the -nowarn command line option is not used. It is recommended that programs be modified to exclude the use of obsolete APIs , although there are currently no plans to completely remove such APIs from the system.
Some APIs in the sun. * packages have changed. These APIs are not intended to be used by developers. Developers importing from the sun. * Packages do this at your own peril and risk. For more information, see Why Developers Shouldn't Write Programs That Cause the Sun. * Packages .
Frank source share