Java2Blog
  • Home
  • Core Java
  • Tutorials
    • Spring
    • Spring Boot
    • Spring MVC
    • Java 8
    • Hibernate
  • Categories
    • Interview Questions
    • Spring Frameworks
    • Core java
    • Python
    • C++
  • NM
close
import_contacts

Java Tutorials

  • Core Java
  • Java Interview questions
  • Java 8 Stream
  • Java interview programs
import_contacts

Data structure and algorithm

  • Data structure in java
  • Data structure interview questions
import_contacts

Spring tutorials

  • Spring tutorial
  • Spring boot tutorial
  • Spring MVC tutorial
  • Spring interview questions

java programs

  • Core Java interview java programs String
    03 June

    How to check if String has all unique characters in java

    Learn about how to check if String has all unique characters in java

    Read More
  • Algorithm Interview java programs String
    17 May

    How to check if one String is rotation of another String in java

    In this post, we will see how to check if one String is rotation of another or not. For example: [crayon-683a564534de5411109264/] Approach: Lets say you need to check whether str1 and str2 is rotation of one another or not. Create a new String with str3= str1 + str1 Check if str3 contains str2 or not. […]

    Read More
  • Algorithm Interview java programs String
    10 May

    How to check if two Strings are Anagrams in Java

    In this post, we will see how to check if two Strings are Anagrams in java. Anagrams mean if two Strings have the same characters but in a different order. For example: Angel and Angle are anagrams There are many ways to check if Strings are anagrams in java. Some of them are: Using String […]

    Read More
  • Algorithm Interview Character java programs String
    08 May

    Java Program to find duplicate Characters in a String

    In this post, we will see how to find duplicate Characters in a String. Approach: Create a HashMap and character of String will be inserted as key and its count as value. If Hashamap already contains char,increase its count by 1, else put char in HashMap If value of Char is more than 1, that means it […]

    Read More
  • Basic java programs Number
    15 December

    How to find GCD and LCM of two numbers in java

    In this post, we will see how to find Greatest common divisor(GCD) and Least Common Multiple(LCM) in java. GCD is calculated using Euclidean algorithm and LCM is calculated using reduction by GCD Eucid algo for calculating GCD is: Lets say , there are two numbers , a and b so GCD of two numbers = […]

    Read More
  • java programs
    23 August

    Java Interview Programs

    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 […]

    Read More
  • Algorithm Algorithm Interview java programs Number
    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 […]

    Read More
  • Algorithm Interview java programs String
    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 […]

    Read More
  • java programs String
    03 August

    Find all substrings of a String in java

    In this post, we will see java program to find all substrings of a String. For example: If input is “abb”  then output should be “a”, “b”,”b”, “ab”, “bb”, “abb” We will use String class’s subString method to find all subString Program: [crayon-683a564539234423835249/] When you run above program, you will get following output: [crayon-683a56453923e862585699/] Above […]

    Read More
  • keyboard_arrow_left Previous
  • 1
  • …
  • 5
  • 6
  • 7
  • 8
  • Nextkeyboard_arrow_right

Newsletter


Let’s be Friends

  • Facebook
  • Twitter
  • LinkedIn

© 2020-22 Java2Blog Privacy Policy