Java Coding Interview Questions (3–4 Years
Experience)
This document contains 10 practical Java coding questions designed for developers with 3–4 years
of experience. Each question is selected to test real-world problem-solving, Java 8 proficiency, and
backend logic understanding commonly expected in interviews.
1. Reverse a String
Question: Write a program to reverse a string without using reverse().
Code Hint: for (int i = [Link]() - 1; i >= 0; i--) {...}
What It Tests: Tests your understanding of loops and string manipulation.
2. Count Character Frequency
Question: Count occurrences of each character using HashMap.
Code Hint: [Link](c, [Link](c, 0) + 1);
What It Tests: Tests logic using collections and data structures.
3. Second Highest in Array
Question: Find the second largest number in an integer array.
Code Hint: [Link](arr); arr[[Link]-2];
What It Tests: Checks understanding of array handling and sorting.
4. Find Duplicates in List
Question: Find duplicate numbers using Java 8 Streams.
Code Hint: [Link]().filter(i -> [Link](list, i) > 1)...
What It Tests: Tests Stream API and collection frequency handling.
5. Sort Employees by Salary
Question: Sort Employee list using Comparator and Streams.
Code Hint: [Link]().sorted((e1,e2)->[Link])...
What It Tests: Tests Java 8 sorting, lambda expressions, and data modeling.
6. Group by Department
Question: Group employees by department using groupingBy().
Code Hint: [Link](e -> [Link])
What It Tests: Tests Stream API and Collector usage.
7. Palindrome Check
Question: Check if a given string is a palindrome.
Code Hint: new StringBuilder(str).reverse().toString()
What It Tests: Tests string manipulation and conditional logic.
8. Filter Bank Customers
Question: Filter customers with balance > 100000 using Streams.
Code Hint: filter(c -> [Link] > 100000)
What It Tests: Tests conditional filtering and real-world data logic.
9. Common Elements
Question: Find common elements between two lists.
Code Hint: [Link]().filter(list2::contains)...
What It Tests: Tests intersection logic and Stream filtering.
10. Transaction Count
Question: Count transactions per account from CSV-like data.
Code Hint: [Link](a -> a, [Link]())
What It Tests: Tests grouping, counting, and analytical thinking using Streams.