You are on page 1of 2

class HelloWorld

{
public static void main(String[] args)
{
String s1="hello";
String s2="hello";
if(s1==s2)
System.out.println("both are equal");
Else
System.out.println(“both are not equal”);
}
}
o/p:- both are not equal.
class HelloWorld
{
public static void main(String[] args)
{
String s1="hello";
String s2="hello";
if(s1.equals(s2))
System.out.println("both are equal");
Else
System.out.println(“both are not equal”);
}
}
o/p:- both are equal.

You might also like