passing enums by ref in java

前端 未结 2 1882
慢半拍i
慢半拍i 2021-01-17 18:39

How can i pass enum parameter by reference in java? Any solution?

2条回答
  •  自闭症患者
    2021-01-17 19:01

    Java is pass by value - always.

    You pass references, not objects. References are passed by value.

    You can change the state of a mutable object that the reference points to in a function that it is passed into, but you cannot change the reference itself.

提交回复
热议问题