2. คำนวณ

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.

 
รหัสที่ 2-6  โปรแกรมที่ทำงานเหมือนรหัสที่ 2-5 แต่ตั้งชื่อต่าง ๆ ในโปรแกรมเป็นภาษาไทย
public class พื้นที่วงกลม {
  public static void main(String[] args) {
    int    รัศมี  = 4;
    double ค่าพาย = 3.14159;
    String ข้อความ  = "วงกลมที่มีรัศมี 4 หน่วย มีพื้นที่  ";
    double พื้นที่ = ค่าพาย * รัศมี * รัศมี;
    System.out.println(ข้อความ + พื้นที่);
  }
}
©2009 S.Prasitjutrakul