Lesson 28 of 34
Inheritance: extends, super
10 min 35 XP
extends ഉപയോഗിച്ച് child class parent-ന്റെ fields-ഉം methods-ഉം inherit ചെയ്യുന്നു. super(...) parent constructor call ചെയ്യുന്നു. Child-ന് ഒരു parent method override ചെയ്ത് സ്വന്തം രീതിയിൽ ചെയ്യാം.
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.ഒരു Java class-ന് ഒരു class മാത്രമേ extend ചെയ്യാനാകൂ (classes-ന് multiple inheritance ഇല്ല). Interfaces ആണ് പരിഹാരം, അടുത്തതായി വരുന്നു.