162k views
0 votes
What is a Java constructor

User Davidcl
by
8.0k points

2 Answers

4 votes

A constructor in Java is a block of code similar to a method that's called when an instance of an object is created. Here are the key differences between a constructor and a method: A constructor doesn't have a return type. ... Unlike methods, constructors are not considered members of a class.

User Carlo Sirna
by
8.3k points
3 votes

A Java constructor is special method that is called when an object is instantiated.

User Theresa
by
8.9k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.