Override equals() method

public class EqualsDemo 
{
	public static void main(String[] args) 
	{
	StringBuffer s1=new StringBuffer("xyz");
	StringBuffer s2=new StringBuffer("xyz");
	if(s1.toString().equals(s2.toString()))
		System.out.println("equal");
	else
		System.out.println("not equal");
	}
}

Download

Operators in Java

Example - equals method
Example - instance of operator


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code