Lesson 21 - The equals() and clone() methods in Java
In the previous lesson, Enumerated types and constants in Java, we went over the enumerated types and constants in Java. In today's tutorial, we're going to focus on the equals() method and introduce object cloning.
The equals() method
The equals() method is related to comparing objects. We already know that we use it to compare strings. The == operator works for primitive data types, such as int or
...End of the preview...
You've come here and that's great! We believe that the first lessons showed you something new and useful
Do you want to continue the course? Go to the premium section.
- Unlimited and permanent access to individual lessons.
- High quality IT knowledge.
- Skills to help you get your dream and well-paid job.
Requested article covers this content:
This tutorial explains differences between the equals() method and the == operator. We'll override hashCode() and learn to create shallow and deep clones.
You gain points by supporting our network. This is done by sending a helpful amount of money to support the site, or by creating content for the network.