Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Genre(){
- private string genre;
- //The constructor which takes parameter genre and assigns to genre;
- //The respective getters, setters and toString function;
- }
- public class Catalogue(){
- private List<Book> booksAvailable;
- private List<Genre> genres;
- public Catalogue(){
- this.genres = new LinkedList<Genre>();
- booksAvailable.add(new Book("Swift", 1999, new Genre("Programming"),20));
- booksAvailable.add(new Book("TheAlChemist", 2000, new Genre("Drama"),20));
- //Name of a book, year of publication, genre, price
- }
- public void getGenre(){
- System.out.println("I am outside the for loop so I will get printed");
- for (Genre genre : genres){
- System.out.println("I am inside the fo each loop so I will not get printed.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement