PrimitiveType

About Primitive Data Types


As you know, this site is called PrimitiveType.com. But what is a primitive type? Programming languages usually have different sorts of data types, and the most basic, built-in types are called primitive types. For example, integers and characters are primitive types in many languages. Other data types that are more complex are often called composite types.

Java, for instance, has the following primitive types: byte, short, int, long, float, double, boolean and char. In Java, a string is not a primitive type, but an object of the class String. Different languages have different primitive types.

Primitive types take up less memory than composite types and can usually be acted on faster by the computer. In Java, a programmer can create an object of the class Integer, but most often this will be less efficient than creating an integer proper, though there are occasions when it is desirable to create an Integer object instead.

Note that a pure object oriented language (which Java is not) does not have any primitive data types, since everything is an object.