Module 2: Basic Elements of Java Flashcards
(130 cards)
Are user-defined names for methods, variables, constants, and classes
Identifiers
Rules in Naming Identifiers
- The first character of your identifier should start with a letter of the alphabet, an underscore (_), or a dollar sign ($).
- Identifier must contain no spaces.
- Identifier must contain no special characters.
- Keywords are Reserved words, thus it should not be used as Identifier
Create identifiers that are _____.
descriptive of their purpose
If your identifier is composed of several words (65,535 characters is the maximum length per identifier), _____ is a good programming practice.
capitalizing the first letter of each word
- Specify the different sizes and values that can be stored in the variable variable
- Defines the values that a variable can take
Data Types
Two Types of Data Types
- Primitive Data Type
2. Reference Data Type (Non-Primitive Data Type)
- The building blocks of data manipulation.
- Basic data types available in Java language.
Primitive Data Type
Include Classes, Interfaces, and Arrays
Reference Data Type (Non-Primitive Data Type)
8 Primitive Data Types
- boolean
- byte
- char
- short
- int
- long
- float
- double
Primitive Data Type:
true or false
boolean
Primitive Data Type:
two’s (2) compliment integer
byte, short, int, and long
Primitive Data Type:
unicode character
char
Primitive Data Type:
IEEE 754 floating point
float and double
Default value of boolean
false
Default value of byte
0
Default value of char
\u0000
Default value of short
0
Default value of int
0
Default value of long
0
Default value of float
0.0
Default value of double
0.0
Range of Values of boolean
true, false
Range of Values of byte
-128 to 127
Range of Values of char
Character representation of ASCII values 0 to 255