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, ಮುಂದೆ ಬರುತ್ತಿವೆ.