Could someone help java code to read number of lines, words and characrters in paragragh .
You can count how may times the \n appears in the paragraph for lines.
For characters the total length of the paragraph String minus the characters: " ", " ", " ", ...
For words user String.split(" "); and count the length of the array minus the elements where you might an empty String with more than one length.
Yes that is a good way to do it. but when you do that you could use StringTokenizer class. it seperates a string to tokens. just change the delimeters to count sentences , lines ,words etc. I hope that could help.
every sencence finish with "."
every line finish with "\n"
every word finish with "\n" , " " , "." or ","
Well my approach would be simple, Buffered reader to read in from file, We will use java's inbuilt Hash Map class to store words, and also to count number of occurrences. Then we bubble sort the words and print top ten words, sounds simple isn't it?
Daniweb member rules include
"Do ensure that all posts contain relevant content and substance and are not simply vehicles for external links"
We also discourage people from simp/ky posting complete solutions.In future please help by pointing people in the right direction.
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"