1. Variables
var count = 42;
final String APP = "demo";
var infers the type from the initializer (Java 10+).
2. Arrays & loops
int[] nums = {1, 2, 3};
for (var n : nums) {
System.out.println(n);
}
3. Text blocks
String sql = """
SELECT * FROM users
WHERE active = true
""";
Summary
Static typing with var sugar; checked exceptions; multi-line strings without concatenation noise.
Loading comments...