((Book)item1).display();
Because you want to:
item1
to type Book
.display()
method that objects of type Book
have.Now examine the following:
public static void main ( String[] args ) { Book book ; Taxable tax = new Book ( "Emma", 24.95, "Austin" ); book = tax; book.display(); System.out.println( "Tax on item 1 "+ book.calculateTax() ); }
Is a type cast necessary? Where should it go?