We're currently using printCopies(), which wasn't part of our original list of methods. Is there another way to print the number of copies?
class Book {
private int numCopies;
public void buyCopies (int copies) {
numCopies = copies;
}
public void checkOut() {
numCopies = numCopies - 1;
}
public int numCopies () {
return numCopies;
}
}
public class Library {
public static void main(String[] args) {
Book b1 = new Book();
b1.buyCopies(5);
b1.checkOut();
System.out.println (b1.numCopies());
}
}
What would the output be?
4
What if we wanted the output to be ...
Copies: 4
The return statement has three effects:
