Java Software Engineer Question:

Download Job Interview Questions and Answers PDF

Tell us what are constructors in Java?

Java Software Engineer Interview Question
Java Software Engineer Interview Question

Answer:

In Java, constructor refers to a block of code which is used to initialize an object. It must have the same name as that of the class. Also, it has no return type and it is automatically called when an object is created.

There are two types of constructors:

☛ Default constructor
☛ Parameterized constructor

Download Java Software Engineer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell us how can you swap the values of two numeric variables without using any other variables?Can you explain me what is Polymorphism?