java a program that converts letters to their corrosponding telephone digits code example

Example: java a program that converts letters to their corrosponding telephone digits

public class digits

{
    public static void main (String letter)

    {

        if (letter=="A" || letter=="B" || letter== "C")
         {
            System.out.println("1");
         }

         else if(letter=="D" || letter=="E" || letter== "F")
         {
            System.out.println("2");
         }

        else if (letter=="G" || letter=="H" || letter== "I")
         {
            System.out.println("3");   
         }
         else if (letter=="J" || letter=="K" || letter== "L")
         {
            System.out.println("4");    
         }
         else if (letter=="M" || letter=="N" || letter== "O")
         {
            System.out.println("5");    
         }    

        else if (letter=="P" || letter=="Q" || letter== "R" || letter== "S")
         {
            System.out.println("6");    
         }    

        else if (letter=="T" || letter=="U" || letter== "V")
         {
            System.out.println("7");    
         }    

         else if (letter=="W" || letter=="X" || letter== "Y" || letter== "Z")
         {
            System.out.println("9");    
         }    


    }

}

Tags:

Misc Example