Java Reference
In-Depth Information
// Use runtime polymorphism with the showData() method
empArray[0].showData(); // Object is of class Employee
empArray[1].showData(); // So is this one
empArray[2].showData(); // Object of subclass
// The following object is either of the class HourlyEmployee
// or of the class Employee, according to the user's input
empArray[3].showData();
}
}
Search WWH ::




Custom Search