ตัวอย่างโค้ดโปรแกรมภาษา java เพื่อวนลูปแสดงตัวอักษร A – Z โดยใช้ลูป for
ตัวอย่างโค้ด A – Z (ตัวใหญ่)
//----------------------------------------------------------
// Author : THAI OPEN CODE
// Author URI: https://www.thaiopencode.com
// Facebook : https://www.facebook.com/ThaiOpenCode
//----------------------------------------------------------
public class PrintAtoZ {
public static void main(String[] args) {
char ch;
for(ch='A'; ch<='Z'; ch++)
{
System.out.print(ch + " ");
}
}
}

ตัวอย่างโค้ด a – z (ตัวเล็ก)
//----------------------------------------------------------
// Author : THAI OPEN CODE
// Author URI: https://www.thaiopencode.com
// Facebook : https://www.facebook.com/ThaiOpenCode
//----------------------------------------------------------
public class PrintAtoZ {
public static void main(String[] args) {
char ch;
for(ch='a'; ch<='z'; ch++)
{
System.out.print(ch + " ");
}
}
}
