concept primitive in category groovy

appears as: primitives
Groovy in Action, Second Edition

This is an excerpt from Manning's book Groovy in Action, Second Edition.

Java distinguishes between primitive types (such as boolean, short, int, double, float, char, and byte) and reference types (such as Object and String). There’s a fixed set of primitive types, and these are the only types that have value semantics—where the value of a variable of that type is the actual number (or character, or true/false value). You cannot create your own value types in Java.

Reference types (everything apart from primitives) have reference semantics—the value of a variable of that type is only a reference to an object. Readers with a C/C++ background may wish to think of a reference as a pointer—it’s a similar concept. If you change the value of a reference type variable, it has no effect on the object it was previously referring to—you’re just making the variable refer to a different object or to no object at all. The reverse is true too: changing the contents of an object doesn’t affect the value of a variable referring to that object.