title: Calling a void method from another class Java
body: <p>I'm trying to call this method from class Student, my student class is linked to my Library, TextBook and LibraryCard class. </p>
  
  <p>My Student class:</p>
  
  <pre><code>   private ArrayList&lt;Student&gt; students;
      private Library collegeLib;
      private Random randomNum;
  </code></pre>
  
  <p>My Student constructor:</p>
  
  <pre><code>public Student(String name, Library library)
  {
      // initialise instance variables
      studentName = name;
      studentJoin = library;
      studentCard = studentJoin.issueCard();
      studentBookBorrowed = null;
  
  }
  </code></pre>
  
  <p>and the method i'm trying to call:</p>
  
  <pre><code> public void study()
      {
          if((studentBookBorrowed == null))
          {
              studentJoin.borrowBook(studentCard);
  
          }
          else if(!studentBookBorrowed.isFinished())
          {
              studentBookBorrowed.readNextChapter();                
          }
          else
          {
              studentBookBorrowed.closeBook();
              studentJoin.returnBook(studentBookBorrowed);
              studentBookBorrowed= null;
  
          }
  
      }
  </code></pre>
  
  <p>In my class College, which i'm trying to call the method in I have done:</p>
  
  <pre><code>private void study(Student student)
      {
       student.study();   
      }
  </code></pre>
  
  <p>and then tried to call the method, study();. </p>
  
  <p>This is the error i'm getting:</p>
  
  <p>Method study in COllege cannot be applied to given types: required: Student; found no arguments. Arguments lists differ in length..</p>
  
  <p>if I try to call the method by doing: Student.study(); i get the error: non-static method study() cannot be referenced from static context.</p>
  
  <p>I cannot change my study() method to static since my lecture doesn't want it in that way.</p>
  
  <p><strong>My attempt of trying to call the method in College</strong></p>
  
  <pre><code>  private void nextStep(){
   ....
    else
         {
  
          study();
         }
   }      
  
  
  private void study(Student student)
  {
   student.study();   
  }
  </code></pre>