Yearly Archives

3 Different ways to print Exception messages in Java

In Java, there are three methods to print an exception information. All of them are present in Throwable class....

3 Different ways to print Exception messages in Java

In Java, there are three methods to print an exception information. All of them are present in Throwable class....

Understanding OutOfMemoryError Exception in Java

In Java, all objects are stored in the heap. They are allocated using new operator. The OutOfMemoryError Exception in...

Understanding OutOfMemoryError Exception in Java

In Java, all objects are stored in the heap. They are allocated using new operator. The OutOfMemoryError Exception in...

Exceptions in Java

What is an Exception? An exception is an unwanted or unexpected event, which occurs during the execution of a...

Exceptions in Java

What is an Exception? An exception is an unwanted or unexpected event, which occurs during the execution of a...

Constructor Overloading in Java

In addition to overloading methods, we can also overload constructors in java. Overloaded constructor is called based upon the...

Constructor Overloading in Java

In addition to overloading methods, we can also overload constructors in java. Overloaded constructor is called based upon the...

Singleton Class in Java

In object-oriented programming, a singleton class is a class that can have only one object (an instance of the...

Singleton Class in Java

In object-oriented programming, a singleton class is a class that can have only one object (an instance of the...

Private Constructors and Singleton Classes in Java

Let’s first analyze the following question: Can we have private constructors ? As you can easily guess, like any...

Private Constructors and Singleton Classes in Java

Let’s first analyze the following question: Can we have private constructors ? As you can easily guess, like any...

Constructor Chaining In Java with Examples

Constructor chaining is the process of calling one constructor from another constructor with respect to current object. Constructor chaining...

Constructor Chaining In Java with Examples

Constructor chaining is the process of calling one constructor from another constructor with respect to current object. Constructor chaining...

Copy Constructor in Java

Like C++, Java also supports copy constructor. But, unlike C++, Java doesn’t create a default copy constructor if you...

Copy Constructor in Java

Like C++, Java also supports copy constructor. But, unlike C++, Java doesn’t create a default copy constructor if you...

Default constructor in Java

Like C++, Java automatically creates default constructor if there is no default or parameterized constructor written by user, and...

Default constructor in Java

Like C++, Java automatically creates default constructor if there is no default or parameterized constructor written by user, and...

Constructors in Java

Constructors are used to initialize the object’s state. Like methods, a constructor also contains collection of statements(i.e. instructions) that...

Constructors in Java

Constructors are used to initialize the object’s state. Like methods, a constructor also contains collection of statements(i.e. instructions) that...