Module 2 Flashcards
Is an attribute associated with a piece of data that tells a computer system how to interpret its value.
Data Type
Specifies the size and
type of variable values, and it has no additional methods.
Primitive data types
Are called reference types because they refer to objects.
Non-primitive data types
Can store whole numbers from -128 to 127.
Byte
Can store whole numbers from -32768 to 32767
Short
Can store whole numbers from
-2147483648 to 2147483647.
Int
Can store whole numbers from -
9223372036854775808 to 9223372036854775807.
Long
Can store fractional numbers from 3.4e−038 to 3.4e+038. Note that you should end the value with an
“f”:
Float
Can store fractional numbers from
1.7e−308 to 1.7e+308.
Double
Can only take the values true or false:
Booleans
Used to store a single character. The character must be surrounded by single quotes, like ‘A’ or ‘c’:
Characters
Is used to store a sequence of
characters (text).
String
Any constant value which can be assigned to the variable
Literal/Constant
Used to represent a decimal, binary, or hexadecimal value.
Integer Literals
Composed of a sequence of decimal digits followed by either a decimal fraction, a decimal
exponent, or both.
Floating-point Literals