Results 1 to 3 of 3
  1. #1
    Innes381 is offline Member
    Join Date
    Jun 2012
    Rep Power

    Default How many words in a joptionpane

    Ok, i am 2 days away from an IT exam, i have a general idea of whats in it, i need to write a program, that counts how many words are there in a sentence via a joptionpane, how should i do this, i havent learnt tokens and stuff, but i know scanners and string handing, i wanted to somehow store the input so it can be scanned and i can count how many " " there are and space++ in a for loop, any advice?

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Bali, Indonesia
    Rep Power

    Default Re: How many words in a joptionpane

    Take a closer look at the java.util.Scanner class. You can define a delimiter pattern that will help you read the string as a tokens from the sentence. Here is a link to the Scanner javadoc for you to start: Scanner (Java Platform SE 7 )

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: How many words in a joptionpane

    Quote Originally Posted by Innes381 View Post
    any advice?
    Getting user input
    Separating the words
    Showing the output

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. printing out words
    By droidus in forum New To Java
    Replies: 7
    Last Post: 09-16-2011, 04:17 AM
  2. Repeating words
    By Junky in forum Suggestions & Feedback
    Replies: 5
    Last Post: 08-18-2011, 06:42 AM
  3. Counting words
    By Wasley in forum New To Java
    Replies: 9
    Last Post: 01-30-2011, 11:57 PM
  4. Help: Num to words
    By MyOnlineChurva in forum New To Java
    Replies: 16
    Last Post: 01-08-2010, 02:41 AM
  5. help w words
    By Gilgamesh in forum New To Java
    Replies: 5
    Last Post: 11-21-2007, 07:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts