Does Java make distinction between value type and reference type

后端 未结 3 1381
灰色年华
灰色年华 2020-12-10 11:04

C# makes distinction of those two. Does java do the same or differently?

3条回答
  •  庸人自扰
    2020-12-10 11:39

    Actually, everything in Java is passed by value, references being a special type of value, just like pointers are values in C. More about the semantics here:

    http://javadude.com/articles/passbyvalue.htm

    C# on the other hand, does have real references a la C++, which are unrelated to reference values... Can it get any more confusing than that?

提交回复
热议问题