A curated collection of hand-picked Java programs designed to strengthen your programming logic and boost your interview confidence.
🧠 About This Repository
This repository contains practical Java programs covering core concepts, data structures, string manipulation, sorting algorithms, and logical problem-solving — all tailored for Software Test Engineers, Automation Testers, SDETs, and Java learners preparing for interviews.
Every program is self-contained, well-commented, and focuses on interview-specific problem-solving techniques that demonstrate your coding ability and logical thinking.
🧩 What You’ll Learn
✅ Core Java fundamentals through hands-on examples ✅ Arrays, Strings, Collections, and Loops mastery ✅ Sorting algorithms like Bubble, Insertion, and Selection Sort ✅ Logical and pattern-based interview problems ✅ Stack, HashMap, and LinkedList implementation ✅ Recursion, matrix operations, and mathematical logic ✅ String operations like reversal, prefix, rotation, and transformation
📚 List of Java Programs Included
Here’s what this collection covers (each program is in a separate file for easy navigation):
-
Create an ArrayList of fruits, convert it into an array, and print all elements.
-
Accept rows and columns from the user to build and print a 2D matrix.
-
Convert a string array to ArrayList using Arrays.asList() and print all elements.
-
Check if parentheses () { } [ ] in a string are balanced using a Stack.
-
Convert a binary number to decimal using Integer.parseInt().
6.Sort an array using Bubble Sort.
7.Build a Simple Calculator performing +, −, ×, ÷ operations using user input.
-
Validate if a string contains only digits.
-
Count set bits (1s) in a binary representation of an integer.
-
Find duplicate elements in an array using a HashSet.
-
Create a dynamic array from user input and display all values.
-
Classic FizzBuzz problem (1 to 100).
-
Compute GCD (Greatest Common Divisor) of two numbers.
14.Demonstrate a HashMap storing employee IDs and names.
15.Implement a custom version of atoi() (convert string to integer).
-
Implement strStr() to find substring index.
-
Sort an array using Insertion Sort.
-
Calculate LCM (Least Common Multiple) of two integers.
-
Find the longest common prefix among an array of strings.
-
Demonstrate LinkedList creation and manipulation (add, remove, display).
-
Input a 2D matrix and print its transpose.
-
Move all zeros to the end of an array.
-
Reverse a name string input by the user.
-
Count occurrences of each character using a HashMap.
-
Generate Pascal’s Triangle.
-
Print numbers from 1 to N using recursion.
-
Print different star and number patterns using nested loops.
-
Remove negative numbers from an array, sort, and display results.
-
Remove vowels from a string.
-
Replace all vowels with ‘*’ and display the new string.
-
Reverse a string using StringBuilder/StringBuffer reverse().
-
Reverse elements in an ArrayList or LinkedList.
-
Reverse the order of words in a sentence.
-
Rotate an array by K positions (left or right).
-
Sort an array using Selection Sort.
-
Sort arrays or strings using Arrays.sort().
-
Sort an ArrayList in ascending and descending order.
-
Sort an array of strings alphabetically.
-
Print a rectangle star pattern based on user input.
-
Check if one string is a rotation of another.
-
Convert a numeric string to an integer manually (without parsing).
42.Remove leading and trailing spaces without using trim().
-
Merge two arrays and display the union (remove duplicates).
-
Find all unique characters in a string.
💻 Tech Stack Used
Language: Java (JDK 8+)
IDE: IntelliJ IDEA / Eclipse / VS Code
Concepts Covered: Core Java, Collections, Loops, Recursion, Arrays, Strings
🏁 How to Run
Clone the repository:
git clone https://github.com/ArpitChoubey/JavaProgrammingInterviewQuestion-Part-II.git
Open any .java file in your IDE.
Compile and run:
javac FileName.java java FileName
Follow the input prompts and observe the output.
🧠 Ideal For
QA Engineers preparing for Java-based interview rounds
Manual Testers transitioning to Automation / SDET roles
Students and beginners learning Core Java concepts
Developers revising fundamentals for coding interviews
🤝 Contributions
Contributions are always welcome! If you have an interesting Java problem or a more optimized approach, feel free to:
Fork this repository
Create a new branch
Add your solution
Submit a Pull Request
Your contributions will help others in the testing and developer community learn faster � �
🌟 Support & Connect
If you find this repository useful, please consider starring ⭐ it on GitHub to help others discover it!
📬 Connect with me on LinkedIn: - https://www.linkedin.com/in/arpitchoubey/ & Medium - https://medium.com/@ArpitChoubey9