Write a program in java to store A to Z alphabets in a single dimension array then display the letters in one column and their UNICODE in another column with appropriate heading as follows:
Index No. Letters UNICODE
0 A 65
1 B 66
public class App {
/**
* The start point of the program
*
* @param args
*
*/
public static void main(String[] args) {
char alphabets[] = { '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' };
System.out.printf("%-15s%-15s%-15s\n", "Index No.", "Letters", "UNICODE");
for (int i = 0; i < alphabets.length; i++) {
System.out.printf("%-15d%-15c%-15d\n", i, alphabets[i], (int) alphabets[i]);
}
}
}
Comments
Leave a comment