Coders Packet

Java Program to check if two words are Anagram or not

By K. Prashant Rama Swamy

Hi, Today we are learning how to check if two words are anagram to each other or not.

Before going into the program let's see what an Anagram is:

An Anagram is a phrase or word that when its letters are rearranged, another phrase or word is created. 

Java Program to check if two words are Anagram

OUTPUT:

Explanation:

So in the first output, we have taken the first word to be arnab and the second word to rnabb. Since these two do not contain the same letters in the same frequency they are not an anagram. In the second output, we have taken the first word to be silent and the second word to listen. Since these two contain the same letters in the same frequency they are anagram.

Thank you for reading this blog. I hope this must have been useful.

 

Download project

Reviews Report

Submitted by K. Prashant Rama Swamy (Prashant)

Download packets of source code on Coders Packet