so I want to call this method from another class which is a non-static method that requires an argument of a string. However when I try to enter an argument into the parameter for the book.borrow method it says that I "cannot make a static reference to a non-static method". What am I doing wrong here?
import java.util.Scanner;
public class LibrarySystem{
public static void main(String[]args){
book book1 = new book("Divergent", "Veronica Roth", "B001", null);
book book2 = new book("Green Eggs and Ham", "Dr Seuss", "B002", null);
System.out.printf("%s\n", book1.title.toString()+ " " + (book1.bookID.toString()));
System.out.printf("%s\n", book2.title.toString()+ " " + (book2.bookID.toString()));
Scanner students = new Scanner(System.in);
String student = String.valueOf(students);
book.borrow(student);
}
}
Underneath has the method that I want to call
public boolean borrow(String borrowerID) {
if (bookID != null) {
this.borrowerID = borrowerID;
return true;
} else {
return false;
}
}