Constructor in Java constructor in Java is a special member method which will be called implicitly (automatically) by the JVM (JAVA VIRTUAL MACHINE) whenever an object is created for placing user or programmer defined values in place of default values. In a single word constructor is a special member method which will be called automatically whenever object is created. The purpose of constructor is to initialize an object called object initialization. Constructors are mainly create for initializing the object. Initialization is a process of assigning user defined values at the time of allocation of memory space. Syntax className () { ....... ....... } Advantages of constructors in Java A constructor eliminates placing the default values. A constructor eliminates calling the normal or ordinary method implicitly. How Constructor eliminate default values ? Constructor are mainly used for eliminate default values by user defined values, whenever we create an ob...
"Learn To Believe Your Inner And Outer Confidence And If You Believe Then You Can Be Winner Of The World"