Java program to compare two Strings

Previous
Next

In this post, we will see how to compare two String in java.
As you might know, String implements Comparable interface, you can use compareTo method to compare two String in java.

Output:

Enter First String : Java
Enter Second String : Blog
First String is Greater than Second String.

That’s all about comparing two Strings in java.

Previous
Next

Join Our News Letter – Stay Updated

Subscribe to Awesome Java Content.




Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog