Ch 3 - Expressions Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is an expression composed of

A

Terms and Operators

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

A variable has three important attributes

A

Name, value, type

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

Names in Java are called?

A

Identifiers

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

What is a variable?

A

a placeholder for a value. A box with a label attached to the outside

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

Syntax for declarations

A

type identifier = expression(initial value);

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

Local Variable

A

Variables declared inside a method

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

Instance Variables or ivars

A

Variables declared within a class but outside of any method and are stored as part of each object

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

class variables

A

Class variables are associated with all objects of a particular class and not with individual objects

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

What is the private keyword

A

indicates that it can only be used within the class that defines it

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

What is the final keyword

A

Declares that the value will not change after the variable is initialized

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

type cast syntax

A

int n = (int) 1.9999;

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

type cast example

A

int feet = (int) (total inches/inches_per_foot);

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

How do you assign a new value to a variable

A

Assignment statement

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

balance += deposit;

A

Add deposit to balance

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

x++;

A

x += 1;

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

balance -= surcharge;

A

subtract surcharge from balance

17
Q

Add y to x

A

x += y;

18
Q

Subtract y from x

A

x -=y;

19
Q

Add 1 to x

A

x++;

20
Q

Subtract 1 from x

A

x–;