i'm working on class called library. class has 2 attributes: books[] array of type book , nbrbooks of type int.
i'm looking build method called addbook book parameter of type book returns true if book added. , returns false if parameter book null. far have this:
public boolean addbook(book book) throws livreinvalideexception { boolean = true; getnbrbooks(); if (book == null) { = false; throw new livreinvalideexception(); } books [nbrbooks] = book; return a; } my professor gave class test check if our code working , doesn't seem work. i'm wondering why...
thanks help!
public boolean addbook(book book){ if( book == null) { return false;} books[nbrbooks] = book; nbrbooks++; return true;} this super simple hope helps bit!
Comments
Post a Comment