Java Program to Display Alphabets (A to Z) using loop

In this article, we will understand how to print Alphabets from A to Z in Java. This is accomplished using a simple for-loop.

  • First we declare a variable x because converting x value into character its print A.
  • Run one for loop and iterate from 0 to 25 index place.
  • Add all index value with declare x and convert all to this in character one by one.
  • Display the result.
				
					public class AlphabetPrint {

	public static void main(String[] args) {
		int x = 65;
		
		for (int i = 0; i < 26; i++) {
			System.out.print((char) (i + x) + " ");
		}
	}
}
				
			
Output :-

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z