Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Author.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import java.util.List;

public class Author extends Person {
private List books;
private final ArrayList<String> books;

public Author(String firstName, String lastName) {
super(firstName, lastName);
books = new ArrayList();
books = new ArrayList<String>();
}

/**
Expand All @@ -28,7 +28,7 @@ public void addBook(String book) {
books.add(book);
}

@Override

public String sortName() {
return String.format("%s, %s", lastName, firstName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public static void main(String[] args) {
author.addBook("Practical Object-Oriented Design in Ruby");
author.addBook("99 Bottles of OOP");

for (String book: author.getBooks()) {
for (String book: author.publishedBooks()) {
System.out.println(book);
}
}
Expand Down