Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
import java.util.Objects; import java.time.LocalDate; public class Human { String name; String surName; int age; LocalDate dateOfBirth; int iin; public Human(String name, String surName, int age, LocalDate dateOfBirth, int iin) { this.name = name; this.surName = surName; this.age = age; this.dateOfBirth = dateOfBirth; this.iin = iin; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Human human = (Human) o; return iin == human.iin; } @Override public int hashCode() { return Objects.hash(iin); // хэш тоже строим по IIN } } public class Main { public static void main(String[] args) { Human h1 = new Human("Yerkebulan", "Orda", 30, LocalDate.of(1995, 5, 5), 123456789); Human h2 = new Human("Yerkebulan", "Orda", 30, LocalDate.of(1995, 5, 5), 123456789); Human h3 = new Human("Almas", "Omarov", 22, LocalDate.of(2003, 3, 3), 987654321); System.out.println("h1.equals(h2): " + h1.equals(h2)); System.out.println("h1.equals(h3): " + h1.equals(h3)); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)