I have checked many websites but did not get the right answer. what is the meaning of constructor in java?
Asked
Active
Viewed 105 times
0
-
3Java questions are off-topic here. You can likely find the answer in a Java textbook. – Yuval Filmus May 28 '19 at 14:55
1 Answers
0
Constructors are used to initialize the object’s state. Like methods of, a constructor also contains collection of statements(i.e. instructions) that are executed at time of Object creation.A constructor is invoked at the time of object or instance creation.

Saba N
- 16
- 1
-
2This question is clearly off-topic for this site. Instead of answering here, flag the question as off-topic and/or request a mod to migrate to [SO]. You can also inform the question asker that this is off-topic here (and where the question should go!). Feel free to answer the question after it has migrated/moved to the appropriate site – dkaeae May 28 '19 at 15:20
-
@dkaeae Brand-new users aren't going to have a good idea of what's on-topic (though Yuval's comment on the question was posted several minutes before this answer). Note that users with less than 15 rep can't flag, and users with less than 50 rep can't comment. – David Richerby May 28 '19 at 15:50
-
Okay i am new here so I'll keep this in mind while answer the next question – Saba N May 28 '19 at 16:07