Hey there! any question in your mind? Ask It Now!.

Popular Categories





How can i compare 2 strings?

+2 votes
86 views
asked in Programming by neha (560 points)
How can i compare 2 strings?

1 Answer

+1 vote
answered by swag31 (1,430 points)
selected by neha
 
Best answer


Its very simple you can compare like this only 
String String1 = "XYZ";
String String2  = "XYZ";

if(String1 .equals(String2))
{
    System.out.println("Strings are equal!");
}

Enjoy!

commented by neha (560 points)
thanks swag31 :) it works.

Related Questions

+1 vote
1 answer 123 views
+1 vote
1 answer 912 views
+3 votes
1 answer 811 views
+2 votes
2 answers 810 views
–1 vote
0 answers 153 views
+6 votes
2 answers 2,966 views
+2 votes
1 answer 134 views
+8 votes
1 answer 130 views
0 votes
1 answer 201 views
+1 vote
0 answers 53 views

Not a Member yet?

Ask to Folks Login

My Account
438 Folks are online
3 members and 435 guest online
Your feedback is highly appreciated