2 example of comparing string in Java

Tutorials Shared by the Internet Community

Advertisements


Synopsis

There are many ways to compare two strings in java. this Java program example explores four different way e.g. using ==, equals, equasIgnoreCase and C

Statistics

  • Total Hits - 15601

  • Total Votes - 99 votes

  • Vote Up - 43 votes

  • Vote Down - 56 votes

  • Domain - javarevisited.blogspot.com

  • Category - JAVA/Core JAVA

  • Submitted By - Javin Paul

  • Submitted on - 2012-07-14 14:30:18

Description

There are many ways to compare two strings in java. this Java program example explores four different way e.g. using ==, equals, equasIgnoreCase and CompareTo. Many people make mistake of comparing String using == operator which is not correct if you are comparing String for content than use equals() method. ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements