title: How to use a class from another package in java?
body: <p>I am wondering how to use a class from another package</p>
  
  <p>here's a file that inside the package project1</p>
  
  <pre><code>package project1;
  
  class student{
  
      void print(){
          System.out.println("s");
      }
  
  }
  
  class teacher{
      void print(){
          System.out.println("t");
      }
  }
  
  public class Project1 {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          // TODO code application logic here
      }
  
  }
  </code></pre>
  
  <p>here's a file inside a the package project2</p>
  
  <pre><code>package project2;
  
  import project1.student;
  
  public class Project2 {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          student x = new student();
      }
  
  }
  </code></pre>
  
  <p>but I am getting a error that student is not in public,</p>
  
  <p>Am I importing the student class in a wrong way that I can't use the student class , or it's impossible to do this?</p>