classRealPrinter{ // the "delegate" voidprint(){ System.out.print("something"); } } classPrinter{ // the "delegator" RealPrinter p = new RealPrinter(); // create the delegate voidprint(){ p.print(); // delegation } } publicclassMain{ // to the outside world it looks like Printer actually prints. publicstaticvoidmain(String[] args){ Printer printer = new Printer(); printer.print(); } }