樹莓派系統安裝(ubuntu版本)無需螢幕
阿新 • • 發佈:2021-07-17
public interface Printer { void print(); } /***********************************/ public class ColorfulPrinter implements Printer{ @Override public void print() { System.out.println("this is colorful printer!!!"); } } /***********************************/ public class BlackWhitePrinter implementsPrinter{ @Override public void print() { System.out.println("this is black white printer!!!"); } } /***********************************/ public class T { public static void main(String[] args) { Printer cp = new ColorfulPrinter();
Printer bp = new BlackWhitePrinter();
Printer ap= new Printer() { @Override public void print() { System.out.println("this is anonymous printer"); } };
Printer lp = () -> System.out.println("this is anonymous printer"); cp.print(); bp.print(); ap.print(); lp.print(); } }