Browsing tag: Design pattern

Constructor in java

Constructors in Java


                A constructor in Java is a block of code similar to a method that’s called when an instance of an object is created. Constructors are used to initialize the object’s state. Like methods, a constructor also contains collection of statements that are executed at time of Object