Java Blog

 
 
 
 public class JAVA_049
 {


    public static void main(String[] args)
    {
       String Text=\"To be or not to be, that is the question; Whether \'this\"
                  +\"nobler in the mind to suffer the sling and arrows of \"
                  +\"outrageous fortune, or to take arms against a sea of \"
                  +\"troubles, and by opposing end them?\";

       System.out.println(\"Text paragraph is : \" + Text + \"\\n\\n\");

       int spaces=0;
       int vowels=0;
       int letters=0;

       int text_length=Text.length( );

       char Ch;

       for(int i=0;i<text_length;i++)
       {
          Ch=Text.charAt(i);
          Ch=Character.toLowerCase(Ch);

          if(Ch==\'a\' || Ch==\'e\' || Ch==\'i\' || Ch==\'o\' || Ch==\'u\')
             vowels++;

          else if(Character.isLetter(Ch))
             letters++;

          else if(Character.isWhitespace(Ch))
             spaces++;
       }

       System.out.println(\"The Text contained vowels : \" + vowels + \"\\n\"
                         +\"                   spaces : \" + spaces + \"\\n\"
                         +\"                  letters : \" + letters );
    }
 }

    Related Post:
  1. Program of an applet to illustrate BarChart

  2. Program to read command line arguments

  3. Even no or Prime no?????

  4. Program that demonstrates type casting

  5. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

  6. Program to show an example of Calling a Base Class Method from a Derived Class

  7. An application that combines several classes and interface

  8. Program to show an example of creating Character Arrays from String objects

  9. Program to display following things on the client machine a)date and time of the server machine b)date and time of the client machine and difference

  10. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  11. GUI application in java, which enter the details of a student and on the submit display the details of the student

  12. Corba program of game

  13. RMI based application, which reads a file with list of marks of student from a client, send it to server and find how many students having distinct

  14. Program for calculating area of a circle on server side,when a client sends request along with given radius and then displaying result on client side

  15. Program to display reverse $ tree

  16. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

  17. File Handling- JAVA

  18. Corba program of Count Client Applet, IDL,Server, Client

  19. Corba program to encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time.

  20. Program to display attributes of a specified file

 
 
Didn't find what you were looking for? Find more on Program to show an example of getting at characters in a String