What is the constructor?



What is the constructor?..

Answer / Mohammad Ayub

A constructor in Java is a special method that is used to create and initialize objects of a class. Constructors have the same name as the class, no return type (except void for an error situation), and can be overloaded by having different numbers or types of parameters. The default constructor is automatically generated if you don't provide one explicitly.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are abstract classes and anonymous classes?

1 Answers   Flextronics, Thomson Reuters, Virtusa,


What is map in java?

1 Answers  


What is anti pattern in cyber security?

1 Answers  


What is Exception handling in Java How do you handle run time errors please explain with an example

2 Answers   Mastek, TCS,


Are primitives objects?

1 Answers  


What is the basic concept of java?

1 Answers  


What is the r character?

1 Answers  


Explain about serializable interface in java?

1 Answers  


How does a cookie work in Servlets?

1 Answers  


How the elements are organized in BorderLayout?

5 Answers  


What is a resource leak ?

1 Answers  


What are byte codes?

1 Answers  


Categories