• 12 November

    Add two numbers represented by Linked List in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. Java Linked List Interview Programs: How to reverse a linked list in java How to reverse a linked list in pairs in java How to find middle element of linked list in java How to detect […]

  • 12 September

    Difference between Iterator and ListIterator in java

    In this post, we will see difference between Iterator and ListIterator in java. They are both used for traversal but it is good to point out differences between them. Iterator vs ListIterator: Parameter Iterator ListIterator Traversal Iterator can be used to traverse List,set, Queue ListIterator can be used to traverse only List. Traversal direction Iterator can […]

  • 08 August

    Fibonacci series program in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. Fibonacci series is numerical series in which next number is sum of previous two numbers. For example : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. There are two ways to print Fibonacci […]

  • 06 August

    Find first non repeated character in a String

    One of the interview question is “How will you find first non repeating character in String.” For example: If input string is “analogy”,  then program should return ‘n’ If input string is “easiest”, then program should return ‘a’ First approach: We will use [LinkedHashMap](https://java2blog.com/linkedhashmap-in-java-with-example/ “LinkedHashMap”) to find first non repeating character in String. Algorithm: Get […]

  • 02 August

    How to find length of string in java without using length() method

    One of the interview question is “How to find length of string in java without using length() method.” There are many ways to find length of String.  Some of them are : Using toCharArray is simplest solution. Using toCharArray Logic Convert string to char array using toCharArray method Iterate over char array and incrementing length […]

  • 01 August

    Java program to check Armstrong number

    Armstrong number is a 3 digit number which is equal to sum of cube of its digits. For example: 371,153 In this post,  we will see how to check for Armstrong number in java. [crayon-6767b0a827380807339888/] When you run above program, you will get following output. [crayon-6767b0a827386958824176/] Please go through Frequently asked java interview Programs for more such […]

  • 01 August

    Java program to reverse a String

    In this post,  we will see java program to reverse a String. There are many ways to do reverse a String in java, some of them are: Using for loop Declare empty String reverse. This will contain our final reversed string. Iterate over array using for loop from last index to 0th index Add character […]

  • 10 July

    wait, notify and notifyAll method in java with example

    You might have noticed Object class has three final method called wait, notify and notifyAll. These methods are used for inter thread communication.  Java 5 has introduced executor framework which takes care of inter thread communication for you and internally uses wait, notify and notifyAll but you still require basic understanding of these methods and […]

  • 08 July

    Binary search in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to perform binary search in java using divide and conquer method.When you want to find a value in sorted array, we use binary search and we will also see […]