Подскажите почему происходит вывод на экран не адреса ссылки на объект, а [Tom Sawyer was written by Mark Twain, Agatha Christie: Hercule Poirot is a detective]
public static void main(String[] args) {
List<Book> books = new LinkedList<Book>();
books.add(new MarkTwainBook("Tom Sawyer"));
books.add(new AgathaChristieBook("Hercule Poirot"));
System.out.println(books);
}
...
private String getOutputByBookType() {
String agathaChristieOutput = author + ": " + getBook().getTitle() + " is a detective";
String markTwainOutput = getBook().getTitle() + " was written by " + author;
String output = "output";
if(this instanceof MarkTwainBook)
return markTwainOutput;
if(this instanceof AgathaChristieBook)
return agathaChristieOutput;
return output;
}