Java Software Engineer Question:
Download Job Interview Questions and Answers PDF
Tell us what are constructors in Java?
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
There are two types of constructors:
☛ Default constructor
☛ Parameterized constructor
Download Java Software Engineer Interview Questions And Answers
PDF
Previous Question | Next 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? |