This discussion is archived
6 Replies Latest reply: Apr 28, 2008 8:53 PM by 807601 RSS

array required, but int found -- help with my code plz

807601 Newbie
Currently Being Moderated
I keep on getting:
***.java:59: array required, but int found
***.java:58: array required, but float found

here is my code: (i'm not looking for a fix, but I'm looking why)

     public static void countWords(String strng) throws IOException
          String changedSent="";
          int spaceCount=0;
          int sp=-1; //used for the location of the space.
          int charCount; //the number of characters.
          int wordCount; //the number of words.
          int averageLetters;
          float vowelCount=0; // the number of vowels
          int counter; // a counter
          //tests for spaces
          spaceCount=countChar(' ',strng);
          //tests for vowels
          wordCount=spaceCount+1; //sets the number of words that there are in the line
     public static int countChar(char counted,String strng)
          int totalCount;
          int sp;
          String changedSent;
          while (sp != -1) {
               if (totalCount==0) {
                    changedSent=strng.substring(0,sp) + strng.substring(sp+1,strng.length());
               } else {
                    changedSent=changedSent.substring(0,sp) + changedSent.substring(sp+1,changedSent.length());