COMP6018 - AdvOOP Flashcards
1
Q
What features were introduced to Java 5?
A
- Autoboxing and unboxing
- Varargs
- Enums
- Static Imports (allows sqrt(PI) instead of Math.sqrt(Math.PI) when statically importing Math)
- Annotations (e.g. @Override)
2
Q
What features were introduced to Java 7?
A
- Binary literals (e.g. 0b00001000)
- Hex literals (I think) (e.g. 0xF0)
- Underscores in numeric literals (e.g. 1_000_000 is now allowed)
- String keys in switch statements
- Revision of Exceptions
– Now represented by Object (?)
– Explicit keywords (?)
– Try-Catch (?)
3
Q
What features were introduced to Java 8?
A
- Lambda expressions (e.g. (int x) -> {x + 1}) - replacement of annonymous inner class
- Method references (e.g. ContainingClass::staticMethodName) (first-class functions - kinda)
- Default method definitions for interfaces
4
Q
A