Pages

Monday, September 19, 2016

Primitive Types

At the beginning of Chapter 3 of JavaScript: The Definitive Guide, David Flanagan writes:
Computer programs work by manipulating values, such as the number 3.14 or the text “Hello World.” The kinds of values that can be represented and manipulated in a programming language are known as types, and one of the most fundamental characteristics of a programming language is the set of types it supports.

. . . JavaScript types can be divided into two categories: primitive types and object types. JavaScript's primitive types include numbers, strings of text (known as strings), and Boolean truth values (known as booleans).

. . . The special JavaScript values null and undefined are primitive values, but they are not numbers, strings, or booleans. Each value is typically considered to be the sole member of its own special type.
In Java the keywords byte, short, int and long refer to 8-, 16-, 32- and 64-bit signed two's complement integers respectively.

The Java keywords float and double refer to 32- and 64-bit IEEE 754 floating-point numbers respectively.

The four Java keywords representing integers (byte, short, int and long) and the two keywords representing floating-point numbers (float and double) are six of the eight primitive data types in Java. The other two primitive data types are boolean, which is either the value true or the value false, and char, which is an unsigned 16-bit Unicode UTF-16 code unit.