Here is the Java code which print the alphabets and numerals.
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- public class Demo {
- public static void main(String args[]) throws Exception {
- BufferedReader br = new BufferedReader(new InputStreamReader(System. in ));
- System.out.println("1-Want to print capital alphabets..?");
- System.out.println("2-Want to print small alphabets..?");
- System.out.println("3-Want to print numerals..?");
- System.out.println();
- System.out.print("Select any option: ");
- int select = Integer.parseInt(br.readLine());
- switch (select) {
- case 1:
- char CH;
- for (CH = 'A'; CH <= 'Z'; CH++)
- System.out.println(CH);
- break;
- case 2:
- char ch;
- for (ch = 'a'; ch <= 'z'; ch++)
- System.out.println(ch);
- break;
- case 3:
- int num, i;
- BufferedReader in = new BufferedReader(new InputStreamReader(System. in ));
- System.out.print("Please enter the limit: ");
- i = Integer.parseInt(br.readLine());
- for (num = 0; num <= i; num++)
- System.out.println(num);
- default:
- System.out.println("Wrong choice");
- }
- }
- }
Thank you, keep learning and sharing.