Проблем относно игра на java
public class Hangman {
    static boolean replay = true; 
    private static Scanner kb = new Scanner(System.in); 
    public static void main(String[] args) {
        RandomAccessFile raf; 
        try{
        System.out.println("Welcome to the game of HangMan"); 
        raf= new RandomAccessFile("Hangman","rw"); 
        String x; 
         while(replay==true){ 
         x=raf.readLine(); 
         PlayGame(x); 
         CarryOn();
         }
        }
        catch(Exception e){ 
        JOptionPane.showMessageDialog(null,e);  
        }
    }
    
      public static void PlayGame(String word){ 
      word =word.toLowerCase(); 
      String hiddenWord = ""; 
      for(int i=0;i<word.length();i++){ 
         hiddenWord+="-";  
      }
      
      String tempHidden = ""; 
      String guesses = "";
      int bodyparts = 6;
      String letter;
       boolean finished = false; 
       while(finished == false ){ 
          System.out.println("Number of body parts left:"+bodyparts); 
          System.out.println("Guesses:"+guesses); 
          System.out.println(hiddenWord); 
          System.out.println("Enter a Letter: "); 
          letter = kb.nextLine();
          for(int x =0;x<word.length();x++){   
           if(letter.charAt(0)==word.charAt(x)) {      
               // word then is true
            tempHidden +=word.charAt(x);   
           }
           else{
                tempHidden +=hiddenWord.charAt(x);             
           }
          }
          String splitWord[] = word.split("");  
           for(int z=0;z<splitWord.length;z++){ 
            if(letter.equalsIgnoreCase(splitWord[z])) {
               break; 
            }
            else if(z==splitWord.length-1){ 
               bodyparts--; 
               break;
               
           }  
           }
          hiddenWord = tempHidden; 
          tempHidden = "";
          if(hiddenWord.equalsIgnoreCase(word) ){ 
              finished = true; 
              System.out.println("Well done you guessed the word!:"+word); 
          }
          if(bodyparts ==0){ 
              finished=true;
              System.out.println("Boo you lose!:"+word); 
          }
          String split[] = guesses.split(" "); 
          for(int i =0;i<split.length;i++)
        {
           if(letter.equalsIgnoreCase(split[i])) 
           {
             System.out.println("letter has allready been entered"); 
           }
           else if(i==split.length-1){ 
               guesses += letter+" "; 
               
               
           }  
        }       
      } 
    }
    
      
      public static void CarryOn(){ 
        System.out.println("Do you want to play again?"+"\n"+"Y/N");
        String choice = kb.nextLine(); 
        if(choice.equalsIgnoreCase("y")){ 
           System.out.println("New Game"+"\n");  
           
        }
        else if(choice.equalsIgnoreCase("n")){ 
            replay = false; 
            
        }
        else{
          System.out.println("Inaccurate choice. Ending program");  
          System.exit(0);      
        }     
    }
    
}
Това е кода, обаче когато го стартирам ми излиза съобщението "java.lang.NullPointerException". Някакви идеи ?
Да стана, благодаря.