A simple program to check anagrams in java


This is a simple program in Java. This program can be used to check if the two given strings are anagram. Two given strings are said to be anagrams when they have equal length and same characters are present in both the Strings. An example of anagram strings is SILENT and LISTEN! Screenshot Code import java.util.*; public class Anagram { public static boolean isAnagram(String s1, String s2) { if (s1.length() != s2.length()) { return false; } s1 = sortCharacters(s1); s2 = sortCharacters(s2); return s1.equals(s2); } public static String sortCharacters(String str)…

Read More