Java Polymorphism, instanceof, and Object Equality Detection
Java's polymorphism is a feature of object-oriented programming that allows different objects to be accessed and manipulated in a uniform way. It enables an instance of a class to exhibit multiple forms at runtime. Polymorphism in Java relies on two basic concepts: inheritance and method overriding.
In Java, a subclass can inherit methods from ...
Posted on Mon, 06 Jul 2026 17:09:53 +0000 by Who
Implementing Custom Objects as HashMap Keys in Java
In Java, the HashMap implementation uses the hashCode() method to determine the storage bucket for a key and the equals() method to check for key equality. The default implementation in the Object class generates a hash code based on the object's memory address. This behavior creates a problem when using custom objects as keys: two distinct ins ...
Posted on Sat, 09 May 2026 05:35:46 +0000 by elbowgrease