8. วัตถุสิ่งของ

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.

 
รหัสที่ 8-32  ตัวอย่างการเรียกตัวสร้างที่ผิด เพราะไม่ได้เรียกที่บรรทัดแรก
import java.util.Date;
public class Time {
  private int hour, minute, second;
  public Time() {
    Date now = new Date();
    this(now.getHours(), now.getMinutes(), now.getSeconds());  
  }   
  public Time(int h, int m, int s) {
    hour = h; minute = m; second = s;
  }
©2009 S.Prasitjutrakul