I have been posting java interview programs on various topics such as Binary tree, LinkedList , String, Number, ArrayList, HashMap etc. So I am consolidating list of java interview programs to create an index post. I will keep adding links to this post whenever I add any new program. These are frequently asked java programs in interview. You can also go through top 50 java interview questions for interview questions.

Table of Contents

### Collections

Java collections APIs provides lots of inbuilt classes and interfaces to handle collections of objects. Here is list of most asked java interview programs on Collections.

- Collections interview questions and answers
- How HashMap internally works in java
- How to iterate over HashMap in java
- How to Sort ArrayList based on attributes using Comparator in java
- How to sort ArrayList based on attributes using Comparable in java
- How to remove duplicates from list in java
- How to iterate over ArrayList in java

### LinkedList

It is one of the most used data structure. In singly linked list, Node has data and pointer to next node. It does not have pointer to the previous node. Last node ‘s next points to null, so you can iterate over linked list by using this condition.

- How to reverse a linked list in java
- How to reverse a linked list in pairs
- How to find middle element of linked list in java
- How to detect a loop in linked list in java
- Find start node of loop in linkedlist
- How to find nth element from end of linked list
- How to check if linked list is palindrome in java
- Add two numbers represented by linked list in java

### Binary tree

A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. Here is list of Java interview programs asked on binary tree.

- Binary tree in java
- Binary tree preorder traversal
- Binary tree postorder traversal
- Binary tree inorder traversal
- Binary tree level order traversal
- Binary tree spiral order traversal
- Binary tree reverse level order traversal
- Binary tree boundary traversal
- Print leaf nodes of binary tree
- Count leaf nodes in binary tree
- get maximum element in binary tree
- Print all paths from root to leaf in binary tree
- Print vertical sum of binary tree in java
- Get level of node in binary tree in java
- Lowest common ancestor(LCA) in binary tree in java

### Array

There are many java tricky interview programs that can be asked in interview.

You should practice these java interview programs on array.

- Find missing number in an array
- search an element in a sorted and rotated array in java
- Find second largest number in array
- Find number occurring odd number of times in array
- Minimum numbers of platforms required for railway station in java
- Find pair whose sum is closest to zero in array in java
- Find pair whose sum is closest to X in array in java
- Find all pairs of elements whose sum is equal to given number
- Search element in row wise and column wise sorted matrix
- Stock buy and sell to maximize profit.

### Sorting

- How to implement merge sort in java
- How to implement bubble sort in java
- How to implement insertion sort in java

### String

String is most used data structure in java. There are lot of java interview programs on String which can be asked in interview.

- How to reverse String in java
- How to check if two Strings are angrams
- Find length of String without using java inbuilt length method
- Find all substrings of String in java
- Find First non repeated character in a String
- Java Program to check Palindrome String
- Why String is immutable in java
- Find duplicate characters in String

### Number

- How to swap two numbers without using temporary variables
- Java program to check prime number
- Find prime factors of number in java
- Java Program to check armstrong number
- Fibonacci series program in java
- Java Program to check Palindrome Number
- Java Program to to find gcd and lcm of two numbers

### Algorithm

#### Join Our Newsletter

Subscribe to Awesome Java Content

Nice Article

with help of your website i learn java based web services

Heartfull thanks for your articles.

Thank you, I am glad that it helped you 🙂

These things are very helpful for anyone.

very helpful

Hi, the article is awesome, I learnt a lot from your blog. This UI is much better than before.

Plz add more interview programming questions to collections in the “Interview Program” section.

Thank you for the feedback. I was working on this UI from last 10 days, I am very glad to hear that it is looking better than previous one.If you want any further improvement, please let me know.

I will surely add more interview questions and will let you know.

Thank you very much learnt lot more here,

can yoy please provide the algorithim for Sorting LINKED LIST

Hi, the article is awesome, I learnt a lot from your blog. could you plzz upload spring boot ,spring batch and node js topic.