plz!.......
help!.......please help me make word count program using java
Page 1 of 1
3 Replies - 854 Views - Last Post: 15 October 2007 - 08:38 AM
Replies To: help!.......
#2
Re: help!.......
Posted 14 October 2007 - 02:11 AM
words that are separated by spaces? try StringTokenizer
st = new StringTokenizer (myString, " "); int numWords = st.countTokens();
#3
Re: help!.......
Posted 14 October 2007 - 02:35 AM
#4
Re: help!.......
Posted 15 October 2007 - 08:38 AM
Flynn, on 14 Oct, 2007 - 02:35 AM, said:
I hope this will help, but please try a little harder. You will not learn this way!
*Word Counter
Write a method that accepts a String object as an argument and returns the number of words it contains.
For instance, if the argument is “Four score and seven years ago” the method should return the number 6.
Demonstrate the method in a program that asks the user to input a string and then passes it to the method.
The number of words in the string should be displayed on the screen.
MOD EDIT: ** Content removed...topic starter must show an effort before answers will be provided **
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|