Creating a deep copy method, Java
问题 I want to make a deep copy method. I seeked help here the other day with this issue, but that was for a copy constructor. Now I need a regular method. I have the code created (nonworking), but I'm just not understanding it completely. public GhostList deepCopy(){ int length=this.getLength(); GhostList jadeed=new GhostList(); Ghost[] data = new Ghost[length]; for (int i=0;i<this.getLength();i++){ data[i] = new Ghost(); data[i].setX(this.ghosts[i].getX()); data[i].setY(this.ghosts[i].getY());