Core Java
-
Copy Constructor example
This is an example of how to create a copy constructor in a class. We have set the example, in order…
Read More » -
Exceptions in Constructors
In this example we shall show you how to handle exceptions in constructors. To handle exceptions in constructors we have performed…
Read More » -
Conflicting Constructors
With this example we are going to demonstrate how to use conflicting constructors in a class. In short, to use…
Read More » -
Generic deep copy
This is an example of how to make a generic copy of a class, using Java reflection. In order to…
Read More » -
Avoid side-effects with Object.clone
In this example we shall show you how to avoid side-effects when using Object.clone. To avoid side-effects when using Object.clone we…
Read More » -
Inheritance constructor calls example
With this example we are going to demonstrate how to inherit constructor calls from a super class to a sub…
Read More » -
Initialize constructor with composition
This is an example of how to initialize a constructor with composition. We have created an object with reference to another…
Read More » -
Default constructor calls superclass constructor
In this example we shall show you how to call the superclass constructor in a default class constructor. An easy…
Read More » -
Use serializable interface to perform deep copy
With this example we are going to demonstrate how to use the Serializable interface to perform a deep copy of…
Read More » -
Deep Copy example – Part 2
This is an example of how to create a deep copy of a class. In order to create a deep copy…
Read More »