Java Programming Questions

The Java language and platform: type system, collections framework, generics, exceptions, the memory and JVM model, and idiomatic object-oriented Java. Covers writing correct Java and reasoning about its runtime and language semantics. A staple server-side and test-automation language surface.

MediumTechnical
47 practiced

Design an idempotent POST endpoint in Java that creates orders and must safely support client retries. Propose an idempotency key scheme, the database schema to record processed idempotency keys and their responses, transaction boundaries to ensure correct behavior under concurrency, and a strategy to garbage collect old idempotency records.

HardTechnical
54 practiced

You need to add a new NOT NULL column with a computed default to a table containing 2 billion rows without blocking writes or causing long locks. Design a zero-downtime migration plan detailing schema rollout steps, backfill strategy (chunked updates, background workers), how to avoid table rewrites or large transactions, how to change the application to be compatible across versions, and how to validate correctness.

EasyTechnical
42 practiced

In Java (Spring Boot) implement or describe a GET /users endpoint that supports query parameters page and size and returns a JSON list of users. The endpoint must also set a response header X-Total-Count with the total number of users matching criteria. Describe the controller method signature, service and repository interactions (you may reference Spring Data Pageable or a manual implementation), and how you would test correctness and edge cases.

HardTechnical
38 practiced

Design a custom JDBC connection pool for Java applications. Describe the key components and algorithms: connection acquisition and release, max pool size, wait time and backpressure behavior, validation of connections, eviction of stale or broken connections, leak detection, and metrics to expose. Explain how you'd implement leak detection and how to avoid thundering herd when the pool is exhausted.

HardTechnical
53 practiced

You observe frequent long GC pauses (hundreds of milliseconds) on a Java 11 service when load increases. Outline diagnostic steps to determine whether GC is the root cause and propose tuning and configuration changes to reduce pauses: heap sizing, G1 tuning parameters, garbage collector choices (G1 vs ZGC vs Shenandoah), GC logging and analysis, and how to validate improvements in staging and production.

Unlock Full Question Bank

Get access to all 33 Java Programming interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.