117k views
0 votes
what is a constructor in java? a constructor is something that holds the private state of an instance. a constructor allows us to create a new instance of a class, usually initializing instance variables. a constructor is a method with instructions on how to use a class. a constructor is a syntax rule in java for placing curly brackets.

User Ngb
by
8.6k points

1 Answer

4 votes

Answer:

A constructor allows us to create a new instance of a class, usually initializing instance variables.

Step-by-step explanation:

When a new object is created, the constructor is called. A constructor can be used to set initial values for object attributes.

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