Given the following class Book, and a Person class as defined elsewhere, public class Book { private Person author; public Book () { author = null; } public Book(Person author) { this.author = author; llother fields, constructors, and methods would be defined here public Person getAuthor() { return author; } public void setAuthor(Person author) { this.author = author; } //Student creates deepCopy method here } Write a method of Book called deepCopy that performs a deep copy of an instance of Book called b.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question
Given the following class Book, and a Person class as defined elsewhere,
public class Book {
private Person author;
public Book () {
author = null;
}
public Book(Person author) {
this.author = author;
}
llother fields, constructors, and methods would be defined here
public Person getAuthor() {
return author;
}
public void setAuthor(Person author) {
this.author = author;
}
//Student creates deepCopy method here
}
Write a method of Book called deepCopy that performs a deep copy of an instance of Book called b.
Transcribed Image Text:Given the following class Book, and a Person class as defined elsewhere, public class Book { private Person author; public Book () { author = null; } public Book(Person author) { this.author = author; } llother fields, constructors, and methods would be defined here public Person getAuthor() { return author; } public void setAuthor(Person author) { this.author = author; } //Student creates deepCopy method here } Write a method of Book called deepCopy that performs a deep copy of an instance of Book called b.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr