The issue is because the paramters that your constructor expecting and what you're passing throw. You had build a constructor with 4 arguments and you're providing only 3 in his creation. You must give it 4 our build a new constructor with 3 paramters, without the publisher in that case.
The correct will be:
Book myBook = new Book ("Seeker","Jack McDevitt",368, "publisher");
E.g:
Book myBook = new Book ("Seeker","Jack McDevitt",368, "Polaris");
Will work as well if you create a new constructor, like:
public Book (String titleBook, String authorBook, int pagesBook)
title = titleBook;
author = authorBook;
numberOfPages = pagesBook;
publisher = null; //In that case, you need to set null here
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…