title: Java compilation error when compiling dependent source files
body: <p>So, I recently started class and objects in java and was solving the question:
  Create a class named 'Student' with String variable 'name' and integer variable 'roll_no'. Assign the value of roll_no as '2' and that of name as &quot;John&quot; by creating an object of the class Student.</p>
  <p>This is the code I wrote:</p>
  <pre><code>public class Student {
      
      String name;
      int roll_no;
  }
  </code></pre>
  <p>I saved this in one file and</p>
  <pre><code>import java.util.Scanner;
  
  public class Studentdemo {
      
      public static void main(String[] args) {
  
          Scanner sc = new  Scanner(System.in);
          
          Student s = new Student();
  
          System.out.print(&quot;Enter the name: &quot;);
          s.name = sc.next();
  
          System.out.print(&quot;Enter the roll number: &quot;);
          s.roll_no = sc.nextInt();
  
          System.out.println(&quot;Name = &quot; + s.name + &quot;\nRoll No. = &quot; + s.roll_no);
      }
  }
  </code></pre>
  <p>I saved this in another file and tried to compile and run this code</p>
  <pre><code>error: cannot find symbol
          Student s = new Student();
          ^
    symbol:   class Student
    location: class Studendemo
  ef.java:9: error: cannot find symbol
          Student s = new Student();
                          ^
    symbol:   class Student
    location: class Studendemo
  2 errors
  error: compilation failed
  </code></pre>
  <p>I tried to run this code in an online compiler, it was running fine on that but not on ubunt</p>