In the latest release of Android Studio (0.4.2), a new setting has been added when creating a new project, namely Language Level I want to know what that refers to, and the consequence of selecting any of the provided options. The doc doesn't give me a clear picture of this and i don't want to select an option when i don't know what that will result in? Thanks
It's about what Java language level you want to use. KitKat supports full Java 7, Gingerbread and up support Java 6 and older versions are Java 5. At least when it comes to the core Java APIs. Roughly the same setting is mentioned here.
You can often use language features that were added in one version in an older version if the compiler knows how to do it. For example the Diamond Operator was added in Java 7 but you can still use that feature in Java 6 since
List<String> list = new ArrayList<>();
actually compiles into the same thing as
List<String> list = new ArrayList<String>();
did.
The "try with resource" construct on the other hand can't be compiled into legal Java 6 compatible code and is therefore exclusive to Apps that require KitKat and up.
The answer can be phrased better, IMHO. The docs are clear about Java 7 and below.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With