Comparing String using == Operator and .equals() method. Bengali-Ep:33

Опубликовано: 03 Август 2026
на канале: Ajoy Debnath
164
3

Hi,
Hope you are all doing great. Let's learn together.
Join Telegram: 📲 https://t.me/contactajoydebnath

Chapters ❤
0:00 Introduction
01:37 Theory
04:47 Code Implementation


Document Link :
https://docs.google.com/document/d/18...

String Document Link:
https://docs.google.com/document/d/1L...

Note:
Java was developed by Sun Microsystems (which is now a subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, James Gosling and his team changed the name from Oak to Java.

STS Link:
https://spring.io/tools

JDK Link:
https://www.oracle.com/java/technolog...

Video Links:
Core Java Playlist:
   • Core Java  

Spring Playlist :
   • Spring Framework  

Java Videos Links :
Sorting with Comparable and Comparator in Java. --    • Sorting with Comparable and Comparator in ...  
Guide To Java 8 Optional Class. Part-II. --    • Guide To Java 8 Optional Class. Part-II Be...  
Guide To Java 8 Optional Class. Part-I. --    • Guide To Java 8 Optional Class. Part-I. Be...  
Stream API: Intermediate & Terminal operations. --    • Stream API : Intermediate & Terminal opera...  
Stream API: Intermediate & Terminal operations. --    • Stream API: Intermediate & Terminal operat...  
Factory Method Design Pattern. --    • Factory Method Design Pattern. Bengali-Ep:...  
How to create an Immutable class in Java? Immutable Design Pattern. --    • How to create Immutable class in Java? Imm...  
Object Cloning, Shallow Copy, and Deep Copy. --    • Object Cloning, Shallow Copy, and Deep Cop...  
Exception, Custom Exception, throw, throws --    • Exception, Custom Exception, throw, throws...  
Exception, try, catch, finally --    • Exception, Propagation try, catch, finally...  
Exception, Exception Hierarchy, Call Stack, Propagation. Bengali-Ep:22 --    • Exception, Exception Hierarchy, Call Stack...  
Lambda Expression, Functional Interfaces, Anonymous Class. --    • Lambda Expression, Functional Interfaces, ...  
Singleton Pattern. Lazy Instantiation for Multiple Threads.Part-2 Bengali-Ep:20    • Singleton Pattern. Lazy Instantiation for ...  
Singleton Design Pattern in Java. Early & Lazy Instantiation Bengali-Ep:19 :    • Singleton Design Pattern Java. Early & Laz...  
HashSet, Its Methods & How It Works Internally in Java:    • HashSet, Its Methods & How It Works Intern...  
HashSet & How It Works Internally in Java. --    • HashSet & How It Works Internally in Java....  
LinkedList, Methods & How It Works Internally in Java. --    • LinkedList, Methods & How It Works Interna...  
ArrayList, ListIterator, How It Works Internally --    • ArrayList, ListIterator, How It Works Inte...  
Collection Framework ----    • Collections Framework, Collection & Iterat...  
'super' keyword -    • 'super' keyword in Java. Bengali-Ep:13  #b...  
'this' keyword -    • 'this' keyword in Java. Bengali-Ep:12  #be...  
Final Keyword -    • Final keyword, Final variable, method, cla...  
Static Keyword, Static variable, block, method, nested class -    • Static keyword, Static variables, block, m...  
Access Modifier. Private, Public, Default, Protected --    • Access Modifier. Private, Public, Default,...  
Encapsulation, Data Hiding, Setter-Getter method, JavaBean Class --    • Encapsulation, Data Hiding, Setter-Getter ...  
Polymorphism, Method and Constructors Overloading, Method Overriding --    • Polymorphism, Method & Constructors Overlo...  
Inheritance, Is-A relationship, the problem with multiple inheritances --    • Inheritance, 'IS-A' relationship, multiple...  
Abstraction, Interface --    • What is Abstraction? Interface Implementat...  
Abstraction, Abstract Class -    • What is Abstraction? Abstract Class Implem...  
What are Class, Object, Method, and Constructors-    • What is  Class, Object, Method, Constructo...  
Environment Setup and why we need to set path in environment variable --    • Environment Setup. Why do you set a Java p...  
First Java Program - "Hello World" --    • First Java Programming "Hello World" Print...  

Spring Video Links:
JDBCTemplate, RowMapper, ResultSetExtractor, BeanPropertyRowMapper Spring --    • JDBCTemplate, RowMapper,ResultSetExtractor...  
Spring JDBCTemplate, JDBC, Statement, and PreparedStatement --    • Spring JDBCTemplate, JDBC, Statement and P...  
What if we remove the @Configuration annotation in Spring? --    • What if we remove the @Configuration annot...  
@Configuration, @Bean, @Component, @ComponentScan in Spring. --    • @Configuration, @Bean, @Component, @Compon...  
Autowiring, Autowiring Modes - byName, byType & constructor. --    • Autowiring, Autowiring Modes - byName, byT...  
Bean Scope, Singleton Scope, and Prototype Scope. --    • Bean Scope, Singleton Scope, and Prototype...  


Like, Comment, Share, and Subscribe.
Thank you again.

Comparing String using == and .equals() method.
Both equals() method and the == operator are used to compare two objects in Java. == is an operator and equals() is method. But the == operator compares the reference or memory location of objects in a heap, whether they point to the same location or not.
Whenever we create an object using the new operator, it will create a new memory location for that object. So we use the == operator to check memory location or address of two objects are the same or not.

We can use == operators for reference comparison (address comparison) and .equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas .equals() evaluates to the comparison of values in the objects.