Primitive


In pc science, a primitive is a elementary information kind that can’t be damaged down right into a more easy information kind. For instance, an integer is a primitive information kind, whereas an array, which might retailer a number of information sorts, just isn’t.

Some programming languages assist more information sorts than others and never all languages implement information sorts the identical method. However, most high-level languages share a number of frequent primitives.

Java, for example, has eight primitive information sorts:

  1. boolean – a single TRUE or FALSE worth (usually solely requires one bit)
  2. byte – 8-bit signed integer (-127 to 128)
  3. quick – 16-bit signed integer (-32,768 to 32,767)
  4. int – 32-bit signed integer (-231 to -231 -1)
  5. lengthy – 64-bit signed integer (-263 to -263 -1)
  6. float – 32-bit floating level quantity
  7. double – 64-bit floating level quantity
  8. char – 16-bit Unicode character
The string information kind is usually thought of non-primitive since it’s saved as an array of characters.

Primitives supported by every programming language are generally known as “built-in data types” since they retailer values instantly in reminiscence. Non-primitive information sorts retailer references to values fairly than the values themselves. Examples of non-primitive Java information sorts embrace arrays and lessons.

Looking to know more Internet Terms