Sunday, January 27, 2019

package seleniumrepo;

import java.util.Arrays;
/*
 * Check whether two strings are anagram of each other
 * Ex: LISTEN <=> SILENT, TRIANGLE <=> INTEGRAL, HEART <=> EARTH
 */
public class Anagram {
public static void main(String[] args) {
String s="LISTEN";
String s1="SILENT";
char[] ch=s.toCharArray();
char[] ch1=s1.toCharArray();
Arrays.sort(ch);
Arrays.sort(ch1);
if(Arrays.equals(ch, ch1)){
                   System.out.println("True - Given number is words are anagrom of each other");
}else{
                   System.out.println("False - Given number is words are not anagrom of each other");
              }
}
}

Related Posts:

  • Hashmap vs Hashtable Difference between Hashmap and Hashtable? HashMap is non-synchronized. Hashtable is synchronized.  HashMap allows multiple threads where as hashtable doesn't HashMap is not thread-safe where as hashtable is. HashMap … Read More
  • Static Keyword Static is a keyword in Java, which is used for static blocks variables methods and  inner classes or nested classes A static member can be accessed directly with the class name with out creating an object.  Th… Read More
  • Java Database Connectivity(JDBC) JDBC: is an acronym for 'Java Data Base Connectivity'. It is used for accessing the databases from Java Applications. JDBC API allows to do CRUD operations on Database. Steps to connectivity between Java program and Dat… Read More
  • TestNG Annotations What is TesNG and What are the annotations in the TestNG?      Ans: TestNG is testing framework to run the test cases. TestNG supports annotations like:       @BeforeSuite       &… Read More
  • String Reverse Example public class StringReverse { public static void main(String[] args) { String str="selenium",reverse=""; for(int i=str.length()-1;i>=0;i--) { reverse=reverse+str.charAt(i… Read More

0 comments:

Post a Comment

Selenium Training in Realtime

Blog helps to a student or IT employee to develop or improve skills in Software Testing.

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts