filmov
tv
Java Tutorial 77 - Exercise - The Cloneable interface

Показать описание
In this tutorial, I will show you how to us the Cloneable interface with an exercise.
Suppose you need to process course information. Each course has a name and has students enrolled. You should be able to add/drop a student to/from the course.
- Add students to the course using the addStudent(String student) method
- Drop a student from the course using the dropStudent(String student) method,
- Return all the students in the course using the getStudents() method.
- Add a clone method to perform a deep copy on the students field.
Suppose you need to process course information. Each course has a name and has students enrolled. You should be able to add/drop a student to/from the course.
- Add students to the course using the addStudent(String student) method
- Drop a student from the course using the dropStudent(String student) method,
- Return all the students in the course using the getStudents() method.
- Add a clone method to perform a deep copy on the students field.