Data Types & Operators Flashcards
Primitive Integer Types
4 - byte, short, int, long
Primitive Floating-Point Types
2 - float, double
Primitive Non-Numeric Types
2 - char, boolean
Number of Primitive Types
8
Bits & Range: byte
8 bits
-128 to 127
Bits & Range: short
16 bits
-32768 to 32767
Bits & Range: int
32 bits
-2,147,483,648 to 2,147,483,647
Bits & Range: long
64 bits
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
char assignment uses what kind of quotes
Single quotes
Operator for testing Boolean values
==
Literals
Fixed values (constants) of any primitive type
Default is int
Postfix l or L for long or f or F for Float - 12L, 10.19f
Octal Literals
Number system based on 8, using digits 0-7
Hexadecimal Literals
Base 16 number system, using digits 0-9 plus A-F (10-15)
Prefix 0X or 0x
Binary Literals
Binary number
Prefix 0B or 0b
String Literals
A set of characters enclosed in double quotes
Escape Sequences
A sequence of characters that does not represent itself when used inside a character or string literal, but is translated to a formatting specifier or character that is hard to represent. Backslash prefix.
'
"
\
Single quote
double quote
Backslash escape sequence