How to tell an object’s class type
If you need to know exactly what the object type of a class is during runtime, you can achieve that using the getClass() method of an object. The getClass() is method of java.lang.Object, which means that every java class has inherited that method. Another technique that you can use is the instanceof operator. When faced [...]
Object life cycle
Java objects go through certain states throughout it’s lifetime, it goes through a specific order of execution. Class is loaded - The default Java class loader kicks in, and loads your class definitions either from the local file system or the network, static initializers (if defined) are executed at this stage. Created – When another [...]