Java Dev Interview Questions: Java 17, Lambda, Streams, and More

Java Developer Interview (3–4 Years Experience) – Here’s a concise list of questions I was asked along with one-liner answers -- Java 17 Features LTS version with features like records, sealed classes, pattern matching, and improved performance. -- what changes done in Java 17 for GC -- Java 8 Features Introduced lambda, streams, functional interfaces, Optional, and new Date-Time API. -- Functional Interface An interface with exactly one abstract method, used for lambda expressions. -- Static Method Use Cases Used for utility methods, shared logic, and when no object state is required. -- Method Reference Shorthand for lambda expressions using :: to directly refer to methods. -- Ways to Create Thread Thread class, Runnable, Lambda, Callable + Future, CompletableFuture. -- CompletableFuture Used for asynchronous programming and combining independent tasks. -- Stream API (Intermediate vs Terminal) Intermediate → lazy transformations; Terminal → triggers execution and gives result. -- map vs flatMap map = one-to-one transformation; flatMap = one-to-many + flattening. -- Memory Issues in Java 8 Heap OOM, Metaspace OOM, memory leaks, GC overhead, stack overflow. -- YAML vs Properties YAML is hierarchical and readable; properties are flat key-value pairs. -- Externalized Configuration (Spring Boot) Store config outside code using properties, YAML, env variables, or command-line. -- Circuit Breaker Prevents cascading failures by stopping calls to failing services and using fallback. -- Orchestration vs Choreography Orchestration = central control; Choreography = event-driven decentralized flow. -- Transaction Propagation Defines how transactions behave when one method calls another (e.g., REQUIRED, REQUIRES_NEW). -- Merging Arrays (Java 8) Use Stream/CompletableFuture to combine arrays cleanly. #java #interviewexperience ##interviewexperience #springboot #backenddeveloper #careergrowth #experiencedhire #javadeveloper

To view or add a comment, sign in

Explore content categories