Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
オブジェクト変数はポインターですか? オブジェクト変数を宣言してから別のオブジェクトを代入すると、オブジェクトは 1 つまたは 2 つになりますか?
具体的には、Android で行う必要があるのは、位置オブジェクトをキャプチャし、それを脇に置いて、次に来る位置オブジェクトと比較したいということです。
2 つの参照を持つ 1 つのオブジェクトがあります。具体的には、
int[] a = {1, 2}; int[] b = a; a[0] = 17; System.out.println(b[0]); // 17
共有されていない新しいインスタンスを作成するには、オブジェクトを明示的に複製するか (そうである場合Cloneable)、その内容を他の方法でコピーする必要があります。
Cloneable