Skip to content

Java Interview Programming Questions for 8+ Years Experienced Developers

This guide consolidates commonly reported Java programming questions from interview experiences shared on Glassdoor and similar platforms, focusing on candidates with around 8 years of experience.

Frequently asked problems include:

  • Reverse each word in a sentence
  • Find character frequency using HashMap
  • Check whether two strings are anagrams
  • Longest substring without repeating characters
  • First non-repeating character
  • String and number palindrome
  • Generate all permutations of a string
  • String compression (aabcc -> a2b1c2)
  • Convert a string to an integer without Integer.parseInt()

Reported examples include reversing words in a sentence and character frequency counting.

Common questions:

  • Armstrong number
  • Prime number (optimized)
  • Fibonacci (iterative, recursive, DP)
  • Factorial
  • Fast exponentiation
  • Palindrome number
  • Count digits / sum of digits
  • Missing number in an array

High-priority topics:

  • Two Sum / Three Sum
  • Find duplicates without extra space
  • Longest consecutive sequence
  • Kadane’s Algorithm
  • Rotate array
  • Merge sorted arrays
  • Kth largest element
  • Stock buy/sell
  • Subarray with given sum

Senior-level collection problems include:

  • Character frequency
  • LRU Cache
  • Custom HashMap
  • First duplicate
  • Group anagrams
  • Sort map by values
  • Cycle detection

Typical questions:

  • Reverse linked list
  • Detect cycle (Floyd’s algorithm)
  • Merge sorted lists
  • Find middle node
  • Remove Nth node from end
  • Clone linked list with random pointer
  • Valid parentheses
  • Min Stack
  • Queue using stacks
  • Next greater element
  • Sliding window maximum

Very common for experienced developers:

  • Print odd/even using two threads
  • Producer-Consumer
  • Thread-safe Singleton
  • Deadlock creation and resolution
  • Custom blocking queue
flowchart LR
    A[Producer] -->|enqueue| B[Blocking Queue]
    B -->|dequeue| C[Consumer]

Interviewers often ask follow-up questions about synchronization, memory visibility, locking, and scalability.

Expected Stream API exercises:

  • Find duplicates
  • Group by property
  • Frequency counting
  • Object sorting
  • Convert list to map
  • Flatten nested collections

Senior candidates are commonly asked to implement:

  • LRU Cache
  • Rate Limiter
  • Parking Lot
  • Thread Pool
  • In-memory Cache
  • Star patterns
  • Spiral matrix
  • Rotate matrix
  • Search in sorted matrix
Company Reported Coding Topics
Oracle Closest palindrome
JPMorgan Concurrency, locking
Publicis Sapient Longest consecutive sequence
Amdocs/Cognizant Core Java + coding exercise

Senior interviews typically emphasize:

  • Time and space optimization
  • Clean, maintainable code
  • Concurrency correctness
  • Practical backend design

Typical interview structure:

flowchart TD
    A[Coding Round] --> B[Solution Discussion]
    B --> C[Optimization]
    C --> D[Concurrency Follow-up]
    D --> E[System Design Discussion]

Common follow-up questions:

  • Make it thread-safe.
  • Reduce memory usage.
  • Handle millions of requests.
  • Improve time complexity.
  1. LRU Cache
  2. Longest substring without repeating characters
  3. Two Sum / K Sum
  4. Reverse linked list
  5. Detect cycle in linked list
  6. Producer-Consumer
  7. Odd-even thread printing
  8. Character frequency using HashMap
  9. Group anagrams
  10. Longest consecutive sequence
  11. Kadane’s Algorithm
  12. Sliding window maximum
  13. Valid parentheses
  14. Merge intervals
  15. Custom comparator sorting
  16. Java Streams transformations
  17. Thread-safe Singleton
  18. Blocking queue
  19. String permutations
  20. Closest palindrome
  • Senior Java interviews focus on optimization, concurrency, and practical design in addition to coding.
  • Arrays, collections, multithreading, and Java Streams are consistently emphasized.
  • Expect follow-up discussions around scalability, thread safety, and production-quality implementation.
  • Preparing the top 20 problems provides strong coverage for many backend Java interviews.