Feb 10, 2022

Java Alphabet A to Z Print in Java Program - Java Program Example

Here we can see a java program for find a to z alphabet with meaning. When we compile this java program then this program take an input as alphabet from a to z and show output meaning that alphabet entered by user after compile program.


Program Code

package com.androidpro.in;




import
java.util.*;

public class
Main {

   
public static void main (String arg[]){
        Scanner input=
new Scanner(System.in);
       
System.out.println("Enter Any Alphabet ");
        char
alphabet =input.next().charAt(0);
        switch
(alphabet) {
           
case 'a':
           
case 'A':
                System.
out.println("a for Apple ");
                break;
            case
'b':
           
case 'B':
                System.
out.println("b for Boy ");
                break;
            case
'c':
           
case 'C':
                System.
out.println("c for Cat ");
                break;
            case
'd':
           
case 'D':
                System.
out.println("d for Dog ");
                break;
            case
'e':
           
case 'E':
                System.
out.println("e for Elephant");
                break;
            case
'f':
           
case 'F':
                System.
out.println("f for Fish ");
                break;
            case
'g':
           
case 'G':
                System.
out.println("g for Girl ");
                break;
            case
'h':
           
case 'H':
                System.
out.println("h for Hen ");
                break;
            case
'i':
           
case 'I':
                System.
out.println("i for Iron ");
                break;
            case
'j':
           
case 'J':
                System.
out.println("j for jug ");
                break;
            case
'k':
            
case 'K':
                System.
out.println("k for kite ");
                break;
            case
'l':
           
case 'L':
                System.
out.println("l for Lion ");
                break;
            case
'm':
           
case 'M':
                System.
out.println("m for Mango ");
                break;
            case
'n':
           
case 'N':
                System.
out.println("n for Nose  ");
                break;
            case
'o':
           
case 'O':
                System.
out.println("o for orange ");
                break;
            case
'p':
           
case 'P':
                System.
out.println("p for Pen ");
                break;
            case
'q':
           
case 'Q':
                System.
out.println("q for  queen ");
                break;
            case
'r':
           
case 'R':
                System.
out.println("r for Rose=");
                break;
            case
's':
           
case 'S':
                System.
out.println("s  for Sun");
                break;
            case
't':
           
case 'T':
                System.
out.println("t for Tree");
                break;
            case
'u':
           
case 'U':
                System.
out.println("u for Umbrella");
                break;
            case
'v':
           
case 'V':
                System.
out.println("v for Van ");
                break;
            case
'w':
           
case 'W':
                System.
out.println("w for window ");
                break;
            case
'x':
           
case 'X':
                System.
out.println("x for X-ray ");
                break;
            case
'y':
           
case 'Y':
                System.
out.println("y for yellow ");
                break;
            case
'z':
            
case 'Z':
                System.
out.println("Z  for zebra ");
                break;
            default
:
                System.
out.println("invalid    Alphabet" );
       
}
    }

}



Output

1. Enter Any Alphabet
A
a for Apple

2. Enter Any Alphabet 

B
b for Bat
3. Enter Any Alphabet
C
c for Cat

Share:

0 Comments: