March 2017

A Guide to the finalize Method in Java

  • Satish 

1. Overview In this tutorial, we’ll focus on a core aspect of the Java language – the finalize method provided by the root Object class. Simply put, this is called before the garbage collection for a particular object.   2. Using Finalizers The finalize() method is called the finalizer. Finalizers get invoked when JVM figures out that this particular instance should be garbage collected. Such a finalizer may perform any operations, including bringing the object back to life. The main purpose of a finalizer is, however,… Read More »A Guide to the finalize Method in Java

Object Type Casting in Java

  • Satish 

1. Overview The Java type system is made up of two kinds of types: primitives and references. We covered primitive conversions in this article, and we’ll focus on references casting here, to get a good understanding of how Java handles types. 2. Primitive vs. Reference Although primitive conversions and reference variable casting may look similar, they’re quite different concepts. In both cases, we’re “turning” one type into another. But, in a simplified way, a primitive variable contains its value, and conversion of… Read More »Object Type Casting in Java