We can use the objects sub-class type, where ever we have super-class type. This program shows how to create a method to compare the entertainments. The Entertainments example discussed in Java Class Inheritance is modified to demonstrate it.
CODE class CompareEntertainmentsUsingMethods OUTPUT Ramayana has the highest collections. DESCRIPTION Here we have created a new method THINGS TO TRY
|