<<< Book and Product example | Index | Interface inheriting other interfaces >>> |
A method that accepts a Printable object
private static void printReport( Printable p ) { p.print(); }
Code that passes a Product object to the method
Product product = new Product( "123", "Gadget", 15.95 ); printReport( product );
<<< Book and Product example | Index | Interface inheriting other interfaces >>> |