Interview prep
Java Interview Questions
Java interviews lean on collections, concurrency and JVM behaviour. Enterprise employers also probe Spring Boot patterns.
Questions and answers
01What is the difference between HashMap and ConcurrentHashMap?
HashMap is unsynchronised and can corrupt or infinite-loop under concurrent writes. ConcurrentHashMap uses per-bin locking and CAS so reads are lock-free and writes contend only on the affected bin.
02Explain the Java memory model in terms of heap and stack.
Each thread has its own stack holding frames and primitives; objects live on the shared heap. Escaping references, not allocation size, are what force objects to survive across frames.
03What does the volatile keyword guarantee?
Visibility and ordering, not atomicity. A volatile read sees the latest write from any thread, but compound operations such as i++ still need synchronisation or an atomic class.
04Checked vs unchecked exceptions — when do you use each?
Checked exceptions model recoverable, caller-actionable conditions; unchecked exceptions model programming errors. Modern codebases lean unchecked and wrap at boundaries rather than propagating checked types everywhere.
05How does garbage collection work on the JVM?
Generational collectors split the heap into young and old regions, collecting the young generation frequently and cheaply. G1 and ZGC add region-based, mostly-concurrent collection to keep pause times bounded.
How to answer these well
Interviewers are not grading recall — they are checking whether you've hit the failure mode the question describes. Anchor every answer to something you actually shipped or debugged with Java.
Say the trade-off out loud. "I'd use X here, but it costs Y under Z conditions" scores higher than a clean textbook definition every time.
Roles asking for Java
- Senior Software Engineer, System Validation - EDA InfrastructureNVIDIA · US, CA, Santa ClarahybridseniorPosted 16 mins ago
- Senior Storage Software Engineer - DGX CloudNVIDIA · US, CA, Santa ClaraonsiteseniorPosted 16 mins ago
- Senior Software Engineer, Capacity Management - DGX CloudNVIDIA · US, CA, Santa ClaraonsiteseniorPosted 16 mins ago
- System Software Engineer - CUDA ChipsNVIDIA · US, CA, Santa ClaraonsitemidPosted 16 mins ago
- Senior Software Engineer, AI FrameworksNVIDIA · US, CA, Santa ClaraonsiteseniorPosted 16 mins ago
- Lead Java Software EngineerCVS · Work At Home-ConnecticutonsiteleadPosted 32 mins ago
- Staff Software Engineer - JavaCVS · RI - WoonsocketonsitestaffPosted 32 mins ago
- Embedded Linux Software Engineer – Robotics Platform (DeviceOS)Anduril · Costa Mesa, California, United StatesonsitemidQuick applyPosted 3 hours ago
- Infrastructure Software Engineer, Active ClearanceAnduril · Costa Mesa, California, United States; Seattle, Washington, United States; Washington, District of Columbia, United StatesonsitemidQuick applyPosted 3 hours ago
- Frontend Software EngineerAnduril · Costa Mesa, California, United StatesonsitemidQuick applyPosted 3 hours ago
Related prep
- Software Engineer jobs
- Software Engineer career guide
- Backend Engineer jobs
- Backend Engineer career guide
- Python interview questions
- JavaScript interview questions
- React interview questions
- AWS interview questions
- Azure interview questions
- Kubernetes interview questions
- Docker interview questions
- Terraform interview questions