Share this post on:

Constructor in Java is a special member of a class. Constructor in Java is used to construct or provide memory to the individuals objects.

There are two types of constructors in Java:

Default Constructor: Deafult constructors are also known as zero parameterise constructors. Zero parameterise constructors does not have any arguments.

Parametrized Constructor: Parametrized Constructor are those constructors which have some arguments. if that contractors contains one arguments then it is called as One Parametrized Constructor or if it contains two arguments then is called as Two Parametrized Constructor.


public class Test{
int a,b;
public Test()
    System.out.println("Zero parametrize constructors");


public Test(int x, int y)
    System.out.println("Two parametrize constructors");


public void print()

public static void main(String[] args)
Test cons=new Test();

Test cons1=new Test(2,3);
Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.


  1. Pingback: Static keyword in Java - ArzaTechs

  2. Pingback: How to Use Super Keyword in Java Program? - ArzaTechs

  3. Pingback: Overloading and Overriding in Java - ArzaTechs

  4. Pingback: What are Important topics in java for Interview? - ArzaTechs

  5. Pingback: How to use Abstract Keyword in Java - ArzaTechs

Leave a Comment

Your email address will not be published. Required fields are marked *