Difference Between Float and Double in Java

Both float and double data types represent floating point numbers in Java. The float data type is a single-precision 32-bit IEEE 754 floating point...
Java Inheritance

Java Inheritance and Composition

Inheritance and composition are the two common methods to reuse code in Java. Inheritance is also known as "IS-A Relationship", composition is known as...
Java Finalize Method

Java Finalize Method

Garbage Collector (GC) reclaims memory occupied by objects that are no longer in use by the program. GC calls object's finalize() method to perform...
Java Immutable Object

Immutable Objects in Java

Immutable objects are objects that cannot be changed once created. For instance, String is an immutable class in Java. Consider the code below, in the first...

Java Defensive Copying

Defensive Copying is a term used for immutable objects. Briefly, you cannot change the state of an immutable object once created. In Java, String class...