Use a Primitive Data Type Instead of an Object Data Type

It is recommended that you use an object only if you must use a property that is specific to this object type. If an equivalent primitive data type exists, then use the primitive. A primitive data type provides superior performance. An object data type consumes more resources than a primitive data type.

The following table lists primitive data types that are equivalent to object data types. For example, if you do not need to use a string-specific object or conversion method, then use the chars primitive instead of a String object.

Primitive Data Type Object Data Type

Chars

String

Float

Number

Bool

Boolean