package Test;
public class Test {
class Book implements Cloneable {
int bookID = 0;
public void setID(int i) {
this.bookID = i;
}
}
class bookFactory {
Book b;
bookFactory() {
b = new Book();
b.setID(20);
}
public Book GetBooks() {
return b;
//now i want to
//return a copy of b but it should be in the original state
}
}
}
i tried using b.clone bt there is no clone function in b object i can simply create a new object bt i want to return book object from the existing object bt with original properties..
Aucun commentaire:
Enregistrer un commentaire