Chapter 2 Defenitions Flashcards
Constant
Describes values that cannot be changed during an execution of an application
Literal constant
A value that is taken literally at each use
Numeric constant
A number whose value is taken literally at each use
Unnamed constant
Has no identifier associated with it
Variable
Named memory location that you can use to store a value
Data type
The type of data that can be stored there, how much memory it occupies, and what type of operations can be performed on the data
Primitive type
a simple data type, For Java these are byte, short, int, long, float, double, char, and boolean
Reference type
Complex data types that are constructed from primitive types
Variable declaration
statements that reserves a named memory location
Strongly typed language
One in which each variable has a well-defined type that limits the operations you can perform with it; implies that variable must be declared before use
Camel casing
Style in which an identifier begins with a lowercase letter and subsequent words with the identifier are capitalised
Assignment operator
The equal sign (=); any value to the right of the equal sign is assigned to the variable to the left of the equal sign
Initialisation
Is an assignment made when you declare a variable
Assignment
The act of providing a value for a variable
Associativity
Refers to the order in which the operands are used with the operators
lvalue
An expression that can appear on the left side of an assignment statement
rvalue
An expression that can appear on the right side of an assignment statement
uninitialised variable
one that has not been assigned to a value
garbage value
unknown value stared in a uninitialised variable
named constant
named memory location whose assigned value cannot change during program execution
symbolic constant
a named constant
The keyword ‘final’
To indicate something is a named constant declaration
blank final
final variable that has not yet been assigned a value
magic number
A value that does not have an immediate, intuitive meaning or number that cannot be explained without additional knowledge = unnamed constant
Scope of a data item
the area in which it is visible to a program and in which you can refer to it using its simple identifier
block of scope
code contained between a set of curly braces
Concatenated
Describes values that are attached end to end
null string
an empty string created by typing a set of quotes with nothing between them
integer
a whole number without decimal places
byte
very small integers -128 - 127
short
small integers -32768 - 32767
long
very large integers
lossy conversion
conversion in which some data is lost
lossless conversion
conversion in which no data is lost
boolean variable
can hold only true or false values
relational operator
compares two items; always has a boolean value
comparison operator
relational operator
Floating -point
number that contains decimal positions
a float data type
can hold a floating point value of up to 6 or 7 significant digits of accuracy
double data type
can hold a floating point value of up to 14 or 15 significant digits of accuracy
significant digits
the mathematical accuracy of a value
char data type
holds a single character
String
Java class that provides you with the means for storing and manipulating character strings
escape sequence
begins with a backslash followed by a character; the pair represents a single character
Standard input device
the keyboard
token
a unit separated with whitespace
prompt
a message that requests and describes user input
Echoing the input
means to repeat the user’s entry as output so the user can visually confirm the entry’s accuracy
keyboard buffer/type-ahead buffer
a small area of memory where key strokes are stored before they are retrieved into a program
To consume an entry
is to receive and discard it without using it
input dialog box
Asks a question and provides a text field in which the user can enter a response
Type-wrapper classes
contained in java.lang package, includes methods that can process primitive data type values
parse
break into component parts
confirm dialog box
Displays the options; Yes, No and Cancel
Standard arithmetic operators
are used to perform calculations with values
operand
A value used in an arithmetic statement
Binary operators
require 2 operands
Floating-point division
is the operation in which 2 values are divided and either both or are floating- point values
Integer division
is the operation in which 2 values are divided and either both or are integers, the result contains no fractional part
The remainder operator
Is the percent sign; when it is used with two integers, the result is an integer with the value of the remainder after devision takes place
Modulus operator
Abbreviated as mod, alternative name for remainder operator
Operator precedence
the rules for the order in which parts of a mathematical expression are evaluated
Type conversion
the process of converting one data type to another
unifying type
is a single data type to which all operands in an expression are converted
implicit conversion
automatic transformation of one data type to another
Promotion
implicit conversion
Type casting
Forces a value of one data type to be used as a value of another type
Cast operator
performs an explicit type conversion; it is created by placing the desired result type in parentheses before the expression to be converted
explicit conversion
is the data type transformation caused using a cast operator
unary cast operator
A more complete name for the cast operator that performs explicit type conversions
unary operator uses how many operands?
uses only one operand