- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java String equals() method.
The equals() method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.
Example
public class Sample{ public static void main(String []args){ String s1 = "tutorialspoint"; String s2 = "tutorialspoint"; String s3 = new String ("Tutorials Point"); System.out.println(s1.equals(s2)); System.out.println(s2.equals(s3)); } }
Output
true false
- Related Articles
- Java String equals() method example.
- String compare by equals() method in Java
- Equals(String, String) Method in C#
- Java Program to Differentiate String == operator and equals() method
- Integer Equals() method in Java
- LocalTime equals() method in Java
- MonthDay equals() method in Java
- Instant equals() method in Java
- Period equals() method in Java
- LocalDateTime equals() method in Java
- IntBuffer equals() method in Java
- FloatBuffer equals() method in Java
- DoubleBuffer equals() method in Java
- ShortBuffer equals() method in Java
- ByteBuffer equals() method in Java

Advertisements