Ch2. Data Types (zybooks) Flashcards Preview

Java 1 > Ch2. Data Types (zybooks) > Flashcards

Flashcards in Ch2. Data Types (zybooks) Deck (25)
Loading flashcards...
1

what is a variable ?

variable= named item that is used to hold a value.

2

assignment statement?

assignment statement: is when a variable is assigned a value. this is done through a statement.

3

what is the format of an assignment? hint: statements and variables

the left side of a statement assignment must be a variable while the right side can be an expression. so...
x = (y+5) X is the variable while (y+5) is the expression.

4

what does
=
mean in programming ? how does it work

=
not equals but instead equals is used to assign a value from the right side to a left side variable.
so... x = 5 means x is assigned 5.

5

what is an incrementing variable and how does it work.

increment variable: when a variable is assigned itself plus one. for example: x = x + 1

6

variable declaration?

statement that declares a new variable -type and name.

7

what is an assignment statement?

assignment statement:

8

what is an assignment statement?

assignment statement:
assigns a variable (left side of = ) with the value to the right of =

9

expression?

expression : a number, variable name or calculation

10

what does 'int' stand for in code?

int = integer or a number.
it tells the memory to allocate a space for the following object. this object holds a number/integer

11

can int variables (integer) hold a negative value?

yes, integer values can hold a negative value.

12

what is a reserve word or keyword?

reserve word/ keyword: a word that is part of the language (int, sort, double,) these words can not be used as an identifier.

13

how is an _ identified when used in an identifier?

_ is treated as a letter and can be the 1st "letter" in the identifier name.

14

are spaces allowed in an identifier name?

no, but _ can be used instead.

15

can an expression be a literal?

expression: evaluates to a value. a literal is a specific value. YES, an expression can be a series of operators (+ - ) with literals or variables or it can just be one literal.

16

can two - - operators that are negative be next to one another?

- - Yes, seen as one a negative and a negation (negative of the following value)

17

Precedence rules?

Precedence rules: how math symbols are used in a problem. order of operations..
() first,
-x negative numbers evaluated before multiplication
...use () often to make expressions clear and oreder of operations.

18

compound operators?

when an operator is compounded for instance: numBalls = numBalls + 1
compounded into:
numBalls += 1

19

are commands allowed in interger literals and if so how are they used?

no. integer intervals can not use commas.

20

variable declared with ;double; means what?

is used to store a floating point number which is when a number has a decimal point within it

21

what is a flouting point litera;?

floating point literal is a number that has a portion that is a fraction and is marked using decimal point with leading zero.

22

how to do scientific notation for floating point literal?

the letter e is used to represent exponent. so 6.02 x 10^23 would be written as: 6.02e23

23

what is the name of a variable that cannot change?

constant variable
if a variable is preceded with final variable then the variables value can not change after that statement.

24

what is a good practicce with writing code when writing a constant variable? what format?

all uppercase letters and word have _ between them.

25

Modulo operator?

Modulo operator = % when division occurs then this symbol tells what the remainer would be.
example: 23 % 10 = 3
see remainder of 3