CodeGym /Courses /Module 2. Java Core /Additional lessons for the level

Additional lessons for the level

Module 2. Java Core
Level 9 , Lesson 7
Available

equals() and hashCode() contracts or whatever

The equals and hashCode methods are closely related to each other, and it's a good idea to override both methods in a consistent way. Plenty of people know this. But not everyone fully understands the reason for this rule and the consequences for breaking it.

In this post, we'll take a look at the idea behind these methods, review their purpose, and explore why they're so related.

Immutability in Java: final, constants and immutable

In this lesson, we will talk about the special final modifier. You can think of it as a way to "freeze" parts of our program where we need constant, unambiguous, and unchanging behavior.

We can apply it to three elements of our program: classes, methods, and variables. Let's go over them in turn.

Comments (1)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Abhishek Tripathi Level 72, Rewa, India Expert
25 October 2023
Please provide the content in English. Google translated version is not good. It often changes the meaning and also it changes the method calls.