Back To Java String Class Index
//program to demonstrate equals method of String class to check whether two strings are equal or not public class stringequals { public static void main(String[] args) { String ob=new String("abcdef"); String ob1=new String("abcdef"); boolean result; result=ob.equals(ob1); if(result==true) { System.out.println("two strings are equal"); } else { System.out.println("two strings are not equal"); } } }