Chapter 2 slides Flashcards

1
Q

what can be included in an identifier?

A

letters, digits, underscores, and dollar signs

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

what can an identifier start with?

A

a letter, an underscore, or a dollar sign. NO DIGITS

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

what can an identifier not be?

A

reserved words, true, false, or null

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

what must a char variable be encased in?

A

single quote, ‘…’ Ex. ‘A’

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

how should variables be named?

A

lowercase unless multiple words, then lowercase first word followed by capital letter of each other word with no spaces in between

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

how should class names be named?

A

no spaces, each word capitalized

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

how should constants be named?

A

capitalize all letters in word, use underscores as spaces

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

how to write exponent operations?

A

System.out.println(Math.pow(n1,n2)); // n1 raised to power of n2

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

how to write scientific notation?

A

(num)e+2 or (num)e2

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

augmented assignment operators

A

+=, -=, *=, /=, or %=. Means n += 8 -> n = n + 8

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

preincrement operators

A

++var and –var. Increase or decrease var by 1, then use the new var in the statement.

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

postincrement operators

A

var++ and var–. increase or decrease var by 1, but use the original var in the statement.

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

order of variable types

A

byte, short, int, long, float, double

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

how to show multiple decimals

A

multiply variable by 100, then divide by 100.0…

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