Tuesday, April 12, 2016

Array Example in Java

How to print all lowerCase letters using array in java?

public class ArrayListExample {
public static void main(String[]args){
char [] a = new char[26];
for(int i =0;i<a.length;i++){
a[i] = (char)(i+'a');


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

Question: Now print all UpperCase letters using the same procedure.

No comments: