Java Tutorial - Inheritance and Polymorphism
Loading...
6,021
Loading...
Uploader Comments (JavaTutorialTV)
see all
Video Responses
see all
All Comments (12)
-
Very clear explanation, thank you so much.
-
I will have an exam tmr about JAVA !!
and you just saved my life thanks !
-
The best ever java tutorials! your emphasize on every word is very meanful.-Thank you-
-
the best tutorial i have found.
thanks a lot
-
Thank you very much for this tutorial.Very helpful. Could you please give an example in which there are two or three levels of inheritances with more sophisticated functions?
Many thanks
Loading...
Also can you also explain, what this statement stand for:
for (Person person : persons)
______________________
thanks
deprosun 7 months ago
@deprosun
for (Person person: persons) means 'for each person in person collection (or array)'. It is called enhanced for loop. Please see my video on enhanced for loop for details (I will attach it to this vid)
JavaTutorialTV 7 months ago
thank you so much for this tutorial. I have a question! can we override a method in a subclass1 in subclass2 ? And i mean, when subclass1 is not overriding any method from super-class.
deprosun 7 months ago
@deprosun, sure you can override that method.
JavaTutorialTV 7 months ago
rabtive, I am glad you found it helpful. Current example has Person extended by Professor. Instead we can have Person extended by Employee and the Employee is extended by Professor. In terms of complexity, Person can have address, gender, age and other things. Employee can have attributes startDate, position, salary, attendance and operations like calculateSalary() and promotion(). The professor can have attributes qualification, classes taught and operations like teach, gradeStudents.
JavaTutorialTV 11 months ago