title: cannot be resolved to a variable error in Eclipse, using enum variable in another class
body: <p>I am using Eclipse Oxygen and I got this error " Ruka cannot be resolved to a variable "in my program, which is made of three classes and I cannot undersand where is my mistake, this variable "Ruka" is defined as an enum method in another class as </p>
  
  <pre><code>" public enum Ruka {
      LEVA, PRAVA;
  }                 "  
  </code></pre>
  
  <p>and here is the second class where the error in the program occures :</p>
  
  <pre><code>import java.util.*;
  public class Ppa1u04 {
      public static Scanner sc;
      public Postava prvniPostava;
      public Postava druhaPostava;
      public Postava vytez;
  
  public static Postava nactiPostavu() {
  
          System.out.print("Jmeno postavy: ");
          String jmeno = sc.nextLine();
          System.out.print("Sila: ");
          int sila = Integer.parseInt(sc.nextLine());
          System.out.print("Hbitost: ");
          int hbitost = Integer.parseInt(sc.nextLine());
          System.out.print("Zdravi: ");
          int zdravi = Integer.parseInt(sc.nextLine());
  
          Postava postava = new Postava(jmeno, sila, hbitost, zdravi);
  
          System.out.println(" ");
  
          return postava;
      }
  
      public static Zbran nactiZbran() {
  
          System.out.print("Nazev zbrane: ");
          String nazev = sc.nextLine();
  
          if(nazev.equals("")) {
              System.out.print("\n");
              return null;
          }
  
          System.out.print("Utok: ");
          int utok = Integer.parseInt(sc.nextLine());
  
          System.out.print("Obrana: ");
          int obrana = Integer.parseInt(sc.nextLine());
  
          Zbran zbran = new Zbran(nazev, utok, obrana);
  
          System.out.println(" ");
  
          return zbran;
      }
      // from here
      public static void vyzbrojPostavu(Postava postava, Zbran prava, Zbran leva) {
          postava.vezmiZbran(Ruka.PRAVA, prava);
  
          postava.vezmiZbran(Ruka.LEVA, leva);
      }
  // to here I have the error " cannot be resolved to a variable"
      public static Postava souboj(Postava PrvniPostava, Postava DruhaPostava) {
              int ubranePrvniZdravi;
              int ubraneDruheZdravi;
              System.out.println("Souboj:\n");
              while(PrvniPostava.getZdravi() &gt; 0 &amp;&amp; DruhaPostava.getZdravi() &gt; 0) {
                  ubranePrvniZdravi = DruhaPostava.branSe(PrvniPostava.zautoc());
                  System.out.println("utoci " + PrvniPostava + " a dava " + ubranePrvniZdravi + " zraneni");
                  if(DruhaPostava.getZdravi() &gt; 0) {
                      ubraneDruheZdravi = PrvniPostava.branSe(DruhaPostava.zautoc());
                      System.out.println("utoci " + DruhaPostava + " a dava " + ubraneDruheZdravi + " zraneni");
                  }
              }
  
              if(DruhaPostava.getZdravi() &gt; 0) {
                  System.out.print("\n");
                  return DruhaPostava;
              }
              System.out.println(" ");
              return PrvniPostava;
  
          }
  
          public static void main(String[] args) {
  
              sc = new Scanner(System.in);
  
              Postava PrvniPostava = nactiPostavu();
              Zbran zbranPravaPrvniPostava = nactiZbran();
              Zbran zbranLevaPrvniPostava = nactiZbran();
              vyzbrojPostavu(PrvniPostava, zbranPravaPrvniPostava, zbranLevaPrvniPostava);
  
              Postava DruhaPostava = nactiPostavu();
              Zbran zbranPravaDruhaPostava = nactiZbran();
              Zbran zbranLevaDruhaPostava = nactiZbran();
              vyzbrojPostavu(DruhaPostava, zbranPravaDruhaPostava, zbranLevaDruhaPostava);
  
              Postava vytez = souboj(PrvniPostava, DruhaPostava);
  
              System.out.print("Vitez: " + vytez);
  
          }
  
      }
  </code></pre>