Lesson 26 of 34
Constructors, this
9 min 30 XP
Constructor എന്നത് class-ന്റെ പേരുള്ള, return type ഇല്ലാത്ത ഒരു പ്രത്യേക method ആണ്. new-ൽ അത് സ്വയം പ്രവർത്തിക്കുന്നു. this.name എന്നാൽ object-ന്റെ field; വെറും name എന്നാൽ parameter.
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.toString() override ചെയ്താൽ System.out.println(object) Book@1b6d3586-ന് പകരം വായിക്കാവുന്ന ഒന്ന് print ചെയ്യും.