Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

can somebody help solve this "DogSearch0.java:28: cannot find symb

$
0
0
public class DogSearch extends WrapIt1
{
  public void run()
  {
        //
    //
    //
    //
    //

    String input = new String("The Dogman was no ordinary dog, nor man, but rather a peculiar dog-like man who barked like a dog, and panted like a dog, he even ate like a dog.  He owned a dog named Doglips, and interestingly enough, his favorite food was hotdogs.");
    println(input);
    int index = -1;
    int count = 0;
    print("Counting dogs:");
    do{
      index = input.findWord("dog");
      if(index != -1){
        count++;
        print(count+" ");
      }
    }while(index != -1);
    println("The word \"dog\" appears "+count+" times.");
  } 
}
//im trying to count the dog but im getting this error


DogSearch0.java:28: cannot find symbol
symbol : method findWord(java.lang.String)
location: class java.lang.String
index = input.findWord("dog");

did i used wrong method
^

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>