Computer Programming 1 Flashcards
MIDTERM
Used to specify the set of values and their operations. The values have particular data types because they are stored in memory of the same format and have the same operations defined for them.
Data type
The fundamental data types in Java. These are predefined data types by the language and named by a keyword.
Primitive data types
8-bit signed integer (0)
Byte
16-bit signed integer (0)
Short
32-bit signed integer (0)
Int
64-bit signed integer (0L)
Long
Single-precision 32-bit IEEE (0.0f)
Float
Double-precision 64-bit IEEE (0.0d)
Double
One bit information (false)
Boolean
Single 16-bit Unicode character (‘\u0000’)
Char
A name for a memory location that stores a specific value, such as numbers and letters.
Variable
A memory location whose value cannot be changed during program execution.
Constant
Keyword used to specify that the value stored in the variable_name is fixed and cannot be changed.
final
Refers to converting a value from a specific type to a variable of another type.
Type casting
The conversion of the lower precision data type to a value of a higher precision data type.
Widening conversion (implicit casting)
The conversion of a higher precision data type into a blue of a lower precision data type.
Narrowing conversion (explicit casting)
These symbols tell the compiler or interpreter of the program to perform a specific mathematical, relational, or logical operation and produce the final result.
Operators
Used to perform basic mathematical operations on numerical values.
Arithmetic operators
+
Addition
-
Subtraction
*
Multiplication
/
Division
%
Modulus
Occurs when either or both of the operands are floating-point values and the result is a floating-point value.
Floating-point division
Occurs when either or both of the operands are integers. The result is an integer, and any factorial part of the result is lost.
Integer division
Are used to evaluate the relation between the operands and generate a decision on that base.
Relational operators
>
Greater than
> =
Greater than or equal
<
Less than
<=
Less than or equal
Return a Boolean value based on the Boolean result of the given expressions.
Logical operators
&&
Logical AND operator
||
Logical OR operator
Bitwise and Logical XOR operator
!
Unary NOT operator
Are used to assign values to a variable.
Assignment operators
It is a collection of rules that specifies which operations need to be performed in an expression.
Order of precedence
A construct made up of variables and operators that evaluates to a single value.
Expression
If all operands in an expression are integers and the expression returns an integer type value.
Integral expression
If all operands in an expression are floating-point numbers, and the expression returns a floating-point value.
Floating-point expression
An expression that has operands of different data types.
Mixed expression
An expression that returns a Boolean value when evaluated.
Logical expression
The methods of this class are used to read data from the standard to input device and store data into variables.
Scanner
Declares an object of Scanner type named input.
Scanner input
Creates a Scanner object connected to the System.in property.
new Scanner (System.in)