Hey ppl im tring to run this code, it compiles but doesnt exucute properly, the loop Statement has an error. please any one help

public class lele
{
   private String word;
   private char letterguessed;
   private int numberOfMistakes;
   private char wronglyGuessLetters;
   private char[] lettersAvalible = new char[26];

   public lele(String word, char letterguessed)
   {
      this.letterguessed = letterguessed;
      this.word = word;
      numberOfMistakes = 0;
      wronglyGuessLetters = (char)0;
      for( int j = 0; j < lettersAvalible.length; j++ )
      {
         lettersAvalible[j] = (char)('A' + j);
      }
   }
   public void displayWord(char[] hiddenWord)
   {
      for ( int i = 0; i < hiddenWord.length; i++)
      {
         if ( letterguessed != word.charAt(i) )
         {
            hiddenWord[i] = '*';
         }
         else
         {
            hiddenWord[i] = (char)letterguessed;
         }
         System.out.print( hiddenWord[i] );
      }
   }
   public void checkGuess(int count)
                        
   {
      for ( int i = 0; i < word.length(); i++)
      {
         if ( letterguessed != word.charAt(i) )
         {
            count++;
         }
         if ( count == word.length() )
         {
            numberOfMistakes++;
            wronglyGuessLetters += (char)letterguessed;
            System.out.println("Number of Mistakes: " + numberOfMistakes + "\nWrongly letters: " + wronglyGuessLetters);
         }
      }
      if( numberOfMistakes == 9 )
      {
         System.out.println("\nGAME OVER");
      }

   }
   public void lettersLeft()
   {
      System.out.println("\nLetters Availble: ");
      for ( int i = 0; i < lettersAvalible.length; i++ )
      {
         if ( letterguessed == lettersAvalible[i] )
         {
            lettersAvalible[i] = (char)' ';
         }
      System.out.print( lettersAvalible[i] );
      }
   }
}

and then.....

import java.util.*;
public class lwlw
{
   public static void main(String[] args)
   {
      System.out.println("Please insert a word to be guessed");
      Scanner keyboard = new Scanner(System.in);
      String word = keyboard.nextLine();
      System.out.println("please guess a letter");
      char letterguessed = keyboard.next().charAt(0);
      int counter = 0;
      char[] hiddenWord = new char[word.length()];
      lele test = new lele(word, letterguessed);
      do
      {
         test.displayWord(hiddenWord);
         test.checkGuess(0);
         test.lettersLeft();
         System.out.println("\nGuess another letter");
         letterguessed = keyboard.nextLine().charAt(0);
         counter++;
         }while( counter != word.length() );
      System.out.print("\nGAME OVER, thanks for using!");

   }
}

thanks for any replys!

Which loop statement? What is the exact line and exact error?

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.