Question: public class Book { private int id; private String name; private String author; private String publisher; public Book(int id, String name, String author, String publisher)
public class Book { private int id; private String name; private String author; private String publisher;
public Book(int id, String name, String author, String publisher) { } }
import java.util.ArrayList; public class BookClient {
public static void main(String[] args) {
}
}
please use the two classes above
in main create an arraylist
create three book objects and add them to the arraylist
use a foor loop to display three books
output should be
1 Harrypotter j.k. rowling
2 leo tolstoy war and peace
3 the lord of the rings Tolkien
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
