자바 프로그램에서 다른 객체와 동일한 객체를 설정하는 것이 맞습니까? 구체적으로는, 나는 이진 트리를 공부하고 난 다음 코드 발견 : Node current = root;
및 current - current.leftChild;
모두가 다른 동일한 개체를 설정하는객체를 Java에서 다른 객체와 동일하게 정의 할 수 있습니까?
public Node find(int key)
{
Node current = root;
while(current.iData != key)
{
if(key < current.iData)
{
current = current.leftChild;
} else {
//...
}
}
}
있다. 이게 옳은 거니?
그게 아니라, 아니. 현재 인스턴스를 다른 인스턴스로 설정 중입니다. – ChiefTwoPencils
읽기 및 이해 https://stackoverflow.com/a/18740042/6194785 –