Explain constructors and types of constructors in java.



Explain constructors and types of constructors in java...

Answer / Tripti Verma

A constructor is a special method that is used to initialize an object. When a new object is created, the constructor executes before any other methods are called. Java has two types of constructors: default constructor (no-arg constructor) which is automatically generated by the compiler if not defined explicitly, and parameterized constructor which can take arguments.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Write the code for Palindrome ?

2 Answers   Bally Technologies,


How is garbage collection controlled?

1 Answers  


String is mutable or immutable?

3 Answers  


what is run time polymorphism

4 Answers  


What is the difference between jdk, jre, and jvm?

1 Answers  


What is the use of flag?

1 Answers  


What are accessor methods in java?

1 Answers  


What is singleton class in java and how can we make a class singleton?

1 Answers  


Write a program to show whether a graph is a tree or not using adjacency matrix.

1 Answers   Amazon,


Explain what pure virtual function is?

1 Answers   Aricent,


Is list ordered in java?

1 Answers  


Can we override the static method?

1 Answers  


Categories