
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Java String equals vs == Operator
String.equals() compares the content while == checks whether the references are pointing to the same object or not.
Example
See the illustration example below −
public class Tester { public static void main(String[] args) { String test = new String("a"); String test1 = new String("a"); System.out.println(test == test1); System.out.println(test.equals(test1)); } }
Output
false true
Advertisements