<<< interface example | Index | Calling method via interface >>> |
A Product class implementing the Printable interface:
import java.text.NumberFormat; public class Product implements Printable { //... // implement the Printable interface public void print() { System.out.println( "Code: " + code); System.out.println( "Description: " + description); System.out.println( "Price: " + this.getFormattedPrice()); } }//class Product
<<< interface example | Index | Calling method via interface >>> |