9. สร้างใหม่จากเก่า

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 9-35  savePower รับอาเรย์ของ PowerSaving เพื่อให้รับอุปกรณ์ที่มีเมท็อด sleep
public class HomeMonitor {
  ...
  public void savePower(PowerSaving[] dev) {
    for (int i=0; i<dev.length; i++)  
      dev[i].sleep();
   }
©2009 S.Prasitjutrakul