Constructor Calling in Java

Constructor calling in Java is possible in multiple ways. In this post, we’ll discuss each of those methods in detail. One thing we should remember is that constructor calling is only possible during the object creation. Once the object is created you won’t be able to call the constructor. You can call a constructor in … Read more

Difference Between null and isEmpty in Java

In Java, particularly when you are working with String class, you may have a situation where a String object either has a null or empty string. Java treats null and empty as two different values. They both are not equal. In Java, if a reference variable has its value as null, it means that it … Read more

Static Block, Instance Block and Constructor: Order of Execution

Overview In Java, we have static block, instance block and constructor which gets executed when we create an instance. All of these blocks can be used to write some initialization logic. Have you ever wondered in what sequence these blocks get executed? First Java looks for the existence of “static blocks”. A static keyword is … Read more