java - passing a double value by reference

后端 未结 6 2233
后悔当初
后悔当初 2021-01-04 13:58

how can I pass a double value by reference in java?

example:

Double a = 3.0;
Double b = a;
System.out.println(\"a: \"+a+\" b: \"+b);
a = 5.0;
System.         


        
6条回答
  •  粉色の甜心
    2021-01-04 14:15

    You can try MutableDouble from commons-lang.

    But not that this has nothing to do with pass-by-reference - you are not passing anything.

提交回复
热议问题