-
-
Save Harishraj16/56022e4019d4105925b5089b040fa270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Library<T extends Book> { | |
private List<T> books = new ArrayList<>(); | |
public void addBook(T book) { | |
books.add(book); | |
} | |
public T borrowBook() { | |
if (!books.isEmpty()) { | |
return books.remove(0); | |
} else { | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment