Tuesday , December 6 2016
Home / JAVA / Constructor in Java

Constructor in Java

In Java Constructor is a block of code which gets executed automatically when object of that class is created. It is not a function so does not return any value. Name of a class and a constructor should be same. Constructor and functions are same only with difference that constructor runs automatically after the initialization of object. Constructor can be called only once when the object is created.

OUTPUT:

constructor in java

Also See:   Multiple Inheritance in JAVA

Check Also

Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In ...

Leave a Reply

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

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.