Page 81 - CTS - CSA TP - Volume 2
P. 81

COMPUTER SOFTWARE APPLICATION - CITS






                    System.out.println(“8. string With Whitespaces  : “ + stringWithWhitespaces);
                 String trimmedString = stringWithWhitespaces.trim();
                   System.out.println(“   Trimmed String (in the begining and end): ‘” + trimmedString + “’”);
               }

           }


           Output:




















           Related Exercise:

           Q1. Develop a java program to input a string through the keyboard and perform various string class methods
           based on User’s Choice.














































                                                           66

                               CITS : IT & ITES - Computer Software Application - Exercise 92
   76   77   78   79   80   81   82   83   84   85   86