void callReceiptBook()
    {
        Customer customer=new Customer();
        customer.name="Brian";
        customerName(customer);    
        System.out.println(customer.name);
    }
    void customerName(Customer cust)    //不明白
    {
        cust.name="Lara";
    }
当调用callReceiptBook()方法,输出结果为什么是"Lara"
解释这段程序 的意思什么 ??非常不明白

解决方案 »

  1.   

    在你调用customerName(customer)之前,name是brian,掉用之后把Lara赋给了name.
      

  2.   

    void customerName(Customer cust)   
    中我知道Customer是一个类,但Customer cust是什么意思
      

  3.   

    你好好把function这一章看看!
    看完了再告诉我是怎么一回事!
      

  4.   

    Customer cust是方法当中对象的引用参数,执行customerName(customer)后,这个引用参数指向了customer,然后把"lara"赋值给了customer.name。