File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes please help me with this code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help me with this code." Watch "please help me with this code." New topic

please help me with this code.

deepak bhai
Ranch Hand

Joined: Apr 22, 2011
Posts: 33

Find the number of occurrences of given word in a sentence.

why its not working
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

Please read this: ItDoesntWorkIsUseless (←click)

Junilu - [How to Ask Questions] [How to Answer Questions]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46375
Write a sentence on paper, and use a pencil to go through the sentence and count not only how many times the word appears in the sentence, but also the index at which you are inspecting the sentence.
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

Why are you checking the same condition in the while statement and the if inside the while?

|Asking Good Questions|
deepak kushwaha
Ranch Hand

Joined: Jul 17, 2010
Posts: 33
Thank you for all the help, The code is fixed. Thank you once again.
I agree. Here's the link:
subject: please help me with this code.
jQuery in Action, 3rd edition