4. เลือกปฏิบัติ

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.

 
รหัสที่ 4-2  ส่วนของโปรแกรมเพื่อตรวจสอบข้อมูลขาเข้า
    double a = kb.nextDouble();
    if (a < 0) {
      System.out.println("กรุณาใส่ a เป็นจำนวนบวก");
      System.exit(-1);
    }
©2009 S.Prasitjutrakul