Module 2 Flashcards
This module will teach you how to program using different data types and keyboard inputs. Specifically, Declare and use constants and variables Use integer data types Use the boolean data type Use floating-point data types Use the char data type Use the Scanner class to accept keyboard input
Cannot be changed while the program is running
For example, System.out.println(459);
CONSTANT
The value that is taken literally at each use.
LITERAL CONSTANT
As opposed to a literal constant.
NUMERIC CONSTANT
No identifier is associated with it.
UNNAMED CONSTANT
Instead of using constant data, you can set up a data item to be _________.
VARIABLE
A named memory location.
VARIABLE
Used to store a value.
VARIABLE
Can hold only one value at a time.
VARIABLE
Its value can change.
VARIABLE
A type of data that can be stored.
DATA TYPE
It refers to how much memory an item occupies.
DATA TYPE
A Data item’s _________ defines the type of data that can be stored there, how much memory the item occupies, and what types of operations can be performed on the data.
DATA TYPE
2 Main Data Types in Java
- PRIMITIVE TYPES
2. REFERENCE OR CLASSES TYPES
8 Primitive Data Types in Java
- BYTE
- SHORT
- INT
- LONG
- FLOAT
- DOUBLE
- CHAR
- BOOLEAN
Are data types considered basic to Java.
PRIMITIVE TYPES
Are more complex data types which hold memory addresses.
REFERENCE OR CLASSES TYPE
The keyword for a byte-length integer.
BYTE
The keyword for a short integer.
SHORT
The keyword for integer.
INT
The keyword for long integer.
LONG
Single-precision floating point.
FLOAT
Double-precision floating point.
DOUBLE
A single character.
CHAR
Can be true or false.
BOOLEAN
Uses naming rules for legal class identifiers; names must be legal Java identifiers; must start with a letter and cannot be a reserved keyword.
NAME VARIABLES
Begins with lowercase letters and capitalizing subsequent words.
CAMEL CASING
To use a variable, you must first D______ it
DECLARE
A statement that reserves a named memory location.
VARIABLE DECLARATION
It Includes data type, identifier, optional assignment operator, and assigned value, and ending semicolon
For example, int age;
VARIABLE DECLARATION
The equal sign (=)
The value to the right is assigned to the variable on the left
For example, int age = 30;
ASSIGNMENT OPERATOR
int age = 30; is called?
DECLARATION AND INITIALIZATION
An assignment made when declaring a variable.
INITIALIZATION
A declared variable but do not assign a value to it.
For example, age = 30;
UNINITIALIZED VARIABLE
Should not change during program execution.
NAMED CONSTANT
Has a data type, name, and value
Has a data type preceded by the keyword final
Can be assigned a value only once
Conventionally is given identifiers using all uppercase letters
NAMED CONSTANT
The area in which a data item is visible to a program, and in which you can refer to it using its simple identifier.
SCOPE
A ___________ is in scope from the point it is declared Until the end of the block of code where the declaration lies
VARIABLE OR CONSTANT
Use alone or in combination with a String.
print() or println() statement
A numeric variable is concatenated to a String using the plus sign.
CONCATENATED
The entire expression becomes a String The println() method can accept a number or String
CONCATENATED
Is a whole number without decimal places.
INTEGER / INT
This data type is based on true or false comparisons.
BOOLEAN
Compares two items; it is sometimes called a comparison operator.
RELATIONAL OPERATOR
A ___________ number contains decimal positions.
FLOATING POINT
Holds any single character. Place a constant character value within single quotation marks.
CHAR / CHAR DATA TYPE
A built-in class Stores and manipulates character strings.
STRING
Are written between double quotation marks.
STRING CONSTANTS
Begins with a backslash followed by a character.
ESCAPE SEQUENCE
Represents a single non-printing character
ESCAPE SEQUENCE