Hi guys, i need some help on my java homework.
i need a text box which will have a piece of text. then i must show how many times every word has written in the text. in my way of thinking i should add every word to an array and compare every word one by one but i am not sure how to separate words from text as element of the array and count them. i am newbie to java and really need some help or ideas. thx.
hsncvs
0
Newbie Poster
Recommended Answers
Jump to PostOne way you could go about it:
. save the text entered in a String
. use the the String split method to create a String[]
. create a hashmap HashMap<String, Integer> and add entries to it using the values in String[] as the key with an …
All 4 Replies
aspire1
36
Light Poster
stultuske
1,116
Posting Maven
Featured Poster
BestJewSinceJC
commented:
Good to see you back on the forums
+5
hsncvs
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.