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

    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
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    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 online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,254
    Rep Power
    19

    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

    db
    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, 03:17 AM
  2. Repeating words
    By Junky in forum Suggestions & Feedback
    Replies: 5
    Last Post: 08-18-2011, 05:42 AM
  3. Counting words
    By Wasley in forum New To Java
    Replies: 9
    Last Post: 01-30-2011, 10:57 PM
  4. Help: Num to words
    By MyOnlineChurva in forum New To Java
    Replies: 16
    Last Post: 01-08-2010, 01:41 AM
  5. help w words
    By Gilgamesh in forum New To Java
    Replies: 5
    Last Post: 11-21-2007, 06: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
  •