当一个引用被声明为等于另一个引用时,它指向什么?初学者参考语义

What does a reference point to when it is declared to be equal to another reference? Begginer Reference Semantics

我是一名新程序员,我正在尝试理解 Java 中的引用语义。 我对下面的代码有一些疑问...

public class Library {
     public void checkOut(Book b) {      
         … 
         //assume that field of b is changed that          
         //shows book is checked out
    }
    public static void main(String [] args) {
         Book b1 = new Book(…);
         Book b2 = new Book(…);
         Book b3 = b2;
         b3.setName(“Inferno”);
         Library l = new Library();
         l.checkOut(b2); 
         if (b3.isCheckedOut()) {
               …
         } else { 
               … 
         }
    } 
}

我理解main方法的前两行构造book references和book objects,新创建的对象存储在reference variables中。

我的问题是main方法的第三行是如何工作的?是不是创建了新的引用b3,指向内存中指向第二本书对象的b2引用?还是创建的b3引用会直接指向内存中的第二本书对象?

当main方法第四行执行时,是不是内存中的book对象发生了变化,再次调用b2或b3时会反映出这种变化?

I understand that the first two lines in the main method construct book references and book objects, and the newly created objects are stored in the reference variables.

不是对象本身,对对象的引用存储在引用变量中。

Or is it that the b3 reference that is created will point directly to the second book object in memory?

是的,b2 引用被复制到 b3 引用,现在 b3 引用同一个对象。

When the fourth line of the main method is executed, is it that the book object in memory is changed, and that change will be reflected when either b2 or b3 is called again?

是的。