my class has an enum definition as property, and an enums type array as property
like this:

public class GameBoard implements Serializable , Cloneable {
    
    private final int N = 8;
    public State[][] Board = new State[N][N];
    public enum State
    {
      empty,player1,player2;   
    }

i want to write a clone method in this class. if i will use a copy method that is defined in Object class will i get a "deep copy" of the class and copy the array or will it only return a reference to the array?

i'm not sure if enum is considered a "basic" type when it comes to copy.

Recommended Answers

All 2 Replies

ok thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.