About 50 results
Open links in new tab
  1. java - What's the difference between primitive and reference types ...

    51 These are the primitive types in Java: boolean byte short char int long float double All the other types are reference types: they reference objects. This is the first part of the Java tutorial …

  2. java - Difference Between Object Type and Reference Type - Stack …

    May 24, 2013 · Object o = new Integer(3); The reference o is of type Object. The object that it references is of type Integer. So the "reference type" would be Object and the "object type" …

  3. Why Java has 4 different types of references? - Stack Overflow

    Feb 7, 2021 · Until today, I wasn't aware of the fact that Java has four main types of references. Strong Reference : Default reference type that Java uses. Weak Reference : If an object has a …

  4. Does Java make distinction between value type and reference type

    Mar 7, 2013 · In Java, all objects and enums are reference types, and all primitives are value types. The distinction between the two is the same as in C# with respect to copy semantics, …

  5. Java: difference between strong/soft/weak/phantom reference

    Mar 21, 2012 · 220 I have read this article about different types of references in Java (strong, soft, weak, phantom), but I don't really understand it. What is the difference between these …

  6. How is String a reference type in Java? - Stack Overflow

    Jul 22, 2018 · The reference in java is not the same as C/C++. s1 and s2 are two reference refer to the same string Hello. Once you change s2 which means s2 refers to a new string Bye while …

  7. When to use primitive and when reference types in Java

    Mar 24, 2010 · In which case should you use primitive types(int) or reference types (Integer)? This question sparked my curiosity.

  8. How to use references in Java? - Stack Overflow

    Like the primitive types this reference is passed by value (e.g. copied). Since everything a programmer can access in java is passed by copying it (references, primitives) and there is no …

  9. Are arrays passed by value or passed by reference in Java?

    Oct 6, 2012 · 325 Everything in Java is passed by value. In case of an array (which is nothing but an Object), the array reference is passed by value (just like an object reference is passed by …

  10. Is Java "pass-by-reference" or "pass-by-value"?

    Sep 3, 2008 · Usually in Java, reference means a reference to an object. But the technical terms pass by reference/value from programming language theory is talking about a reference to the …