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:
- boolean – a single TRUE or FALSE worth (usually solely requires one bit)
- byte – 8-bit signed integer (-127 to 128)
- quick – 16-bit signed integer (-32,768 to 32,767)
- int – 32-bit signed integer (-231 to -231 -1)
- lengthy – 64-bit signed integer (-263 to -263 -1)
- float – 32-bit floating level quantity
- double – 64-bit floating level quantity
- char – 16-bit Unicode character
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
Leave a Reply