asked 162k views
0 votes
What is a Java constructor

asked
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.

answered
User Carlo Sirna
by
8.3k points
3 votes

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

answered
User Theresa
by
8.9k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.