Lesson 28 of 34
Inheritance: extends மற்றும் super
10 min 35 XP
extends மூலம் ஒரு class (child) இன்னொரு class-ன் (parent) fields, methods-ஐப் பெறும். super(...) parent constructor-ஐ அழைக்கும். 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-ஐ மட்டுமே extends செய்ய முடியும் (multiple inheritance இல்லை). அதற்கு interfaces பயன்படும், அடுத்த பாடம்.