I forgot some java concept.
PaymentData payment = basket.getPaymentData();
PaymentData newPayment = payment;
basket.unMaskCreditCardNumbers(payment);
basket.maskCreditCardNumbers(payment);
Here issue is when unmask the payment
object, newPayment
object also unmasking. if I mask payment object newPayment object again masking.
Is this happened by "object by reference"?
Thank You
Yes. Both payment
and newPayment
are references/pointing to the same object.
在Java中,一切都是通过值传递的,这意味着在您的情况下,引用将从payment
复制到newPayment
。
不,它是按值引用的对象。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.