title: Why I am getting "Cannot find symbol error " in this code?
body: <p>I am trying to learn abstract method and abstract class but I don't understand why I am getting error. Can anyone please help me find the cause of the error?</p>
  
  <p>I've tried to check the spellings of java file and class and methods. But they seem fine.</p>
  
  <pre><code>// Code from filename: Person.java 
  // abstract class
  abstract class Person {
      public String fname = "John";
      public int age = 24;
      public abstract void study(); // abstract method 
    }
  
    // Subclass (inherit from Person)
    class Student extends Person {
      public int graduationYear = 2018;
      public void study() { // the body of the abstract method is provided here
        System.out.println("Studying all day long");
      }
    }
  // End code from filename: Person.java
  
  // Code from filename: MyClass.java
  class MyClass {
    public static void main(String[] args) {
      // create an object of the Student class (which inherits attributes and methods from Person)
      Student myObj = new Student(); 
  
      System.out.println("Name: " + myObj.fname);
      System.out.println("Age: " + myObj.age);
      System.out.println("Graduation Year: " + myObj.graduationYear);
      myObj.study(); // call abstract method
    }
  }
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <blockquote>
    <p>MyClass.java:4: error: cannot find symbol
        Student myObj = new Student(); 
        ^                   ^   symbol:   class Student   location: class MyClass</p>
  </blockquote>