Chp 2: Using Data Flashcards

1
Q

declaring/using variables

A

format:
[datatype] [name/identifier] = [initial value]

ex:
String name = “”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

using the boolean Data Type

A

a logical data type

it’s either true or false

ex:
if ( boolean condition )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

floating-point data types

float
double

A

data types that have decimals

double takes up more memory/space than float, so it stores greater values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

char data types

A

stores one character

single quotation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

declaring a constant

A

makes it possible for the variable to not be changed
changes the variable into a mathematical constant
becomes read only

you use “final”

ex:
final double pi = 3.14159;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

performing arithmetic using variables and constants

A
\+
-
/
*
%
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

type conversion

A

you can use either parse or cast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

primitive type: the most basic data types available for Java

A

int
byte, short, int, long

float

double

char

boolean

String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

strongly typed language

A

one of the characteristics of Java

you need to tell the variables in advance for Java to understand
variables/datas in Java have several types
Java has many rules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

assignment operator

A

=
used to assign a (new) value to a variable

ex:
age = 18;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

cast operator

A

to convert a variable into another variable on the fly

( )

ex:
if age is an int,
(double) age

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

uninitialized variable

A

something that Java does not have this: a variable with no initial value
All variables must be declared and initialized

ex: the initial value of a String variable cannot be null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

garbage value

A

random data that will not be used in the program, so it takes up memory for no reason

ex: the value we use to initialize variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

block of code

A

a section of code that’s together

sometimes put within braces { }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly