Page 336 - CA_Blue( J )_Class10
P. 336

10          if(Character.isLetter(ch))
                11               System.out.println(ch + " is a Letter");

                12          else
                13                if(Character.isDigit(ch))

                14                     System.out.println(ch+ "is a Digit");
                15      }

                16  }


                             To input a number into a String, convert it into an integer and add 25 to it. Then again, convert it back
                Program 2
                             to String and display the result.
                 1  import java.util.*;

                 2  class convert

                 3  {
                 4      public static void main()

                 5      {
                 6          Scanner sc= new Scanner(System.in);

                 7          String str;
                 8          int n;

                 9          System.out.print("Enter a number in string : ");
                10          str = sc.next();

                11          n = Integer.parseInt(str);
                12          n = n + 25;

                13          str= Integer.toString(n);
                14          System.out.println( "Result is "+ str);

                15      }
                16  }




                Program 3    To input n characters and print number of letters or digits taken from user.

                 1  import java.util.*;

                 2  class count
                 3  {

                 4      public static void main()

                 5      {
                 6          Scanner sc= new Scanner(System.in);



                334334  Touchpad Computer Applications-X
   331   332   333   334   335   336   337   338   339   340   341