- Section summarizes updated language features in Java SE 9 and subsequent releases
instanceofoperator: pattern matching can be used- If result is
true, object tested is automatically assigned to variable previously declared- Pattern Matching for the instanceof Operator
- Records: a kind of type declaration that is ideal for "plain data carriers"
- Classes containing data not meant to be altered but have fundamental methods such as constructors and accessors
- Records
- If result is
- Programmer's Guide to Text Blocks
- Switch Expressions
- Text blocks:
- Multiline string literals that don't require common escape sequences
switchexpressionsyeildstatement instead ofbreak
switchexpressionscaselabel that prevents fall through- Switch Expressions
var- identifier
- Inferring type of local variables from context
- This makes code more readable and reduces amount of required boilerplate code
- Module system
- It is named self-describing collection of code and data
- Code is organized as a set of packages containing
- Types
- Java classes
- Java interfaces
- Data
- Resources
- Static info
- Types
- Modules can export or encapsulate packages
- They can express dependencies on other modules explicitly
- Project Jigsaw
- More Concise try-with-resources Statements
- Small language Changes in Java SE 9