-
Notifications
You must be signed in to change notification settings - Fork 596
Expand file tree
/
Copy pathAuthor.java
More file actions
36 lines (29 loc) · 763 Bytes
/
Author.java
File metadata and controls
36 lines (29 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
import java.util.ArrayList;
import java.util.List;
public class Author extends Person {
private List<String> books;
public Author(String firstName, String lastName) {
super(firstName, lastName);
books = new ArrayList();
}
/**
* @deprecated Use publishedBooks instead
*/
@Deprecated
public List<String> getBooks() {
return books;
}
public List<String> publishedBooks() {
return books;
}
public void addBook(String book) {
books.add(book);
}
@Override
public String fullName() {
return String.format("%s, %s", lastName, firstName);
}
}