[JAVA 9] What are the main features released in Java 9?
Module System (Project Jigsaw) - JShell REPL - Private methods in Interfaces - Stream API enhancements (takeWhile - dropWhile - iterate) - Optional enhancements - Collection factory methods (List.of - Set.of - Map.of) - Reactive Streams (Flow API) - HTTP/2 Client - Process API updates - Stack-Walking API
[JAVA 9] What is the Java 9 Module System (Project Jigsaw)?
The Module System allows the JDK and applications to be divided into named modules. Each module declares what it exports and what it requires. This improves encapsulation - reduces the classpath and makes large applications easier to maintain
[JAVA 9] What is JShell in Java 9?
JShell is a Read-Eval-Print-Loop (REPL) tool that allows developers to execute Java statements interactively without creating a class or main() method. Useful for quick testing and experimentation
[JAVA 9] What are the new Collection factory methods in Java 9?
List.of() - Set.of() and Map.of() create immutable collections in one line. Adding or removing elements throws UnsupportedOperationException. Much cleaner than Arrays.asList() for immutable collections
[JAVA 9] What are the new Stream methods added in Java 9?
takeWhile(predicate) returns elements while predicate is true then stops. dropWhile(predicate) skips elements while predicate is true then returns the rest. iterate(seed - predicate - function) adds predicate-based termination
[JAVA 9] Can interfaces have private methods in Java 9?
Yes - Java 9 allows private methods in interfaces to share common code between default methods within the same interface without exposing that code to implementing classes
[JAVA 9] What is the Flow API in Java 9?
The Flow API introduces Reactive Streams support with Publisher - Subscriber - Subscription and Processor interfaces for building asynchronous and backpressure-aware data pipelines
[JAVA 9] What enhancements were made to Optional in Java 9?
Java 9 added ifPresentOrElse() - stream() to convert Optional to Stream - and or() to provide an alternative Optional when the original is empty
[JAVA 9] MEMORY BOOSTER: Java 9 key features
Java 9 = Modules + JShell + private interface methods + List/Set/Map.of(). Module System is the biggest change since Java 1. JShell = interactive Java playground. List.of() = immutable one-liner. takeWhile/dropWhile = smarter stream processing
[JAVA 10] What are the main features released in Java 10?
Local Variable Type Inference (var keyword) - Application Class-Data Sharing - Parallel Full GC for G1 - Garbage Collector Interface - Thread-Local Handshakes - Root Certificates - Time-Based Release Versioning
[JAVA 10] What is the var keyword in Java 10?
var enables Local Variable Type Inference. The compiler infers the type of a local variable from the right-hand side of the assignment. Example: var list = new ArrayList<String>() - compiler infers ArrayList<String>. Only works for local variables not fields or method parameters</String></String>
[JAVA 10] What are the limitations of the var keyword in Java 10?
var can only be used for local variables with an initializer. It cannot be used for method parameters - return types - fields or variables without initialization. The type is fixed at compile time - it is NOT dynamic typing
[JAVA 10] What is Application Class-Data Sharing in Java 10?
Class-Data Sharing allows application classes to be placed in a shared archive to reduce startup time and memory footprint when multiple JVM instances run the same application
[JAVA 10] MEMORY BOOSTER: Java 10 key features
Java 10 = var keyword. var = local variable type inference = compiler figures out the type. var is NOT dynamic typing. Type is fixed at compile time. Cannot use var for fields - method params or return types. Only local variables with initializer
[JAVA 11] What are the main features released in Java 11 (LTS)?
New String methods (isBlank - strip - lines - repeat) - New File methods (readString - writeString) - HTTP Client API (standard) - Local Variable Syntax for Lambda (var in lambdas) - Nest-Based Access Control - Flight Recorder open sourced - Launch Single-File Source Programs - Epsilon GC - ZGC (experimental)
[JAVA 11] What are the new String methods introduced in Java 11?
isBlank() checks if string is empty or whitespace. strip() removes leading and trailing whitespace (Unicode-aware). lines() returns a Stream of lines. repeat(n) returns the string repeated n times. stripLeading() and stripTrailing() for one-sided removal
[JAVA 11] What is the difference between strip() and trim() in Java 11?
trim() removes only ASCII whitespace (below Unicode 32). strip() is Unicode-aware and removes all types of whitespace including Unicode whitespace characters. strip() is the modern preferred method
[JAVA 11] What is the HTTP Client API in Java 11?
The HTTP Client API became standard in Java 11. It supports HTTP/1.1 and HTTP/2 - synchronous and asynchronous requests - and WebSocket. It is a clean modern alternative to the old HttpURLConnection
[JAVA 11] What does the new File API in Java 11 provide?
Files.readString(path) reads a file into a String in one line. Files.writeString(path - string) writes a String to a file in one line. These replace multi-line boilerplate for simple file operations
[JAVA 11] Can we use var in Lambda parameters in Java 11?
Yes - Java 11 allows var in lambda parameter declarations: (var x - var y) -> x + y. This enables adding annotations to lambda parameters which was not possible with plain lambda syntax
[JAVA 11] What is the Epsilon Garbage Collector in Java 11?
Epsilon GC is a no-op garbage collector that allocates memory but never reclaims it. Useful for performance testing - memory pressure analysis and short-lived jobs where GC overhead should be eliminated
[JAVA 11] MEMORY BOOSTER: Java 11 key features
Java 11 = LTS. Key: String.isBlank/strip/lines/repeat + Files.readString/writeString + HTTP Client standard + var in lambdas. strip() beats trim() for Unicode. Java 11 is Long-Term Support - commonly used as a production baseline
[JAVA 12] What are the main features released in Java 12?
Switch Expressions (preview) - Shenandoah GC (experimental) - Microbenchmark Suite - JVM Constants API - Default CDS Archives - G1 GC improvements
[JAVA 12] What is the Switch Expression introduced in Java 12?
Java 12 introduced Switch Expressions as a preview feature. Unlike the traditional switch statement the new switch expression can return a value - uses arrow syntax (case X -> result) and does not fall through between cases