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, అవి తర్వాత వస్తాయి.