

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
String compare by equals() method in Java
The equals() method of the String class 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 Test { public static void main(String args[]) { Integer x = 5; Integer y = 10; Integer z =5; Short a = 5; System.out.println(x.equals(y)); System.out.println(x.equals(z)); System.out.println(x.equals(a)); } }
Output
false true false
- Related Questions & Answers
- String compare by compareTo() method in Java
- Java String equals() method.
- Java String equals() method example.
- String compare by == operator in Java
- Equals(String, String) Method in C#
- Integer 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
- CharBuffer equals() method in Java
- Duration equals() method in Java
- LocalTime equals() method in Java
- MonthDay equals() method in Java
Advertisements