Monday, October 17, 2016

Constructors

Constructor is a block of code that allows you to create object of class.

Difference between Constructor and Methods

Constructor do not have abstract, final, static and synchronised access modifiers can have only public, private Where methods can have all of this

Constructor do not have any return types where as methods have return types

The purpose of the constructor is to create the object of class where is the purpose of the method
is to perform any task by executing block of code.


Types of constructor : 
  • Default constructor
  • No-argument constructor
  • Parasitised constructor  


0 comments:

Post a Comment