-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBook.java
41 lines (33 loc) · 843 Bytes
/
Book.java
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
37
38
39
40
41
public class Book {
private String title;
private String year;
private Author author;
public Book(String title, String year, Author author) {
setAuthor(author);
setTitle(title);
setYear(year);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
public void displayDetails() {
System.out.println("Title: " + title);
System.out.println("Year: " + year);
System.out.println("Author: " + author.getName());
}
}