Chapter 4: Fundamental Data Types Flashcards
How many primitive types are in java?
8
How many integer types are there?
4
How many floating-point types in java?
2
What is Integer.MAX_Value?
2.14 billion
What is Integer.MIN_VALUE
-2.14 billion
What is a number literal?
any number in a java program
What happens when a numeric computation overflows?
the result falls outside the range for the number type
T/F There is a warning when a numeric computation overflows?
False
What is the simplest remedy for numeric computation overflows?
Use the long type
T/F: It is legal to assign an integer type to a floating-point variable
true
When does a rounding error occur?
when an exact representation of a floating-point number is not possible
T/F: it is legal to assign a double value to an int value?
false - it is an assignment error
What are numerical constants?
values that do not change and have special significance for a computation
What happens when you tag a variable final?
You can never change after it has been set
What do many programmers name constants?
All upper case, separating words with underscores
How are constants declared?
public
What is an expression
The combination of variables, literals, and/or method calls
What does integers and floating-point values in an arithmetic expression yield?
a floating-point value
What does the ++ operator do?
adds 1 to a variable
What does the – operator do?
subtracts 1 from a variable
If both arguments are integers, and the mathematical result is a floating-point number, what happens to the remainder?
It is discarded
What does the modulus operator compute?
the remainder of an integer division
What is the modulus operator?
%