title: JAVA illegal start of type
body: <p>My program:<p></p>
  
  <pre><code>public class m
  {
      public static void main (String[] args)
      {
          boolean bool = true;
  
          while(bool)
          {
              rand_number player_1 = new rand_number();
              System.out.println("Player_1 guessed " + player_1.rand_n);
  
              rand_number player_2 = new rand_number();
              System.out.println("Player_2 guessed " + player_2.rand_n);
  
              rand_number player_3 = new rand_number();    
              System.out.println("Player_3 guessed " + player_3.rand_n);
  
              if(player_1.guessed || player_2.guessed || player_3.guessed)
              {
                  System.out.println("We have a winner");   
                  bool = false;
              }
          }
      }
  }
  
  class rand_number
  {
      int rand_n = (int)(Math.random() * 10);
  
      if(rand_n == 2) 
      {
          boolean guessed = true;
      }
  }
  </code></pre>
  
  <p>I'm getting this error: <code>m.java:31: illegal start of type</code>. The syntax is absolutely right, I have checked it million times. What's wrong?</p>