Chapter 2 Flashcards

1
Q

What is a constant?

A

Data item whose value cannot be changed while a program is running

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

What is a variable?

A
  • Named memory location used to store a value
  • Can hold only one value at a time
  • Its value can change
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the data type describe?

A
  • How much data that can be stored
  • How much memory an item occupies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are reference types?

A
  • Complex data types
  • Hold memory adresses
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an uninitialized variable?

A
  • Declared within a method, but no value assigned
  • Garbage value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a named constant?

A
  • Named memory location for which values should not change
  • decloration statement is preceded by keyword final
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a scope?

A

Area in which a data item is visible to a program

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

When is a variable or constant in scope?

A

From the point it is declared up until the end end the bllock where the decloration lied

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

What are the integer types?

A

int, byte, short, and long

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

What must you do when you use long integer types?

A

use “L”
i.,e, long test = 200000000000L

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

What must you do when you use float data types?

A

Type the letter “f”
i.e., float test = 2000000000F

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

What is an escape sequence?

A
  • Allows you to store nonprinting character such as a backspace or a tab in a char variable
  • Begins with a backword slash followed by a character
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a string?

A
  • Built-in class
  • Stores and manipulates character strings
  • String constants are written between double quotation marks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are text blocks?

A
  • Multiline lateral string
  • Start and end with three double characters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does system.out refer to?

A

Standard output device, usually the monitor

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

What is the system.in object?

A
  • Refers to standard input device (normally the keyboard)
17
Q

What is a Scanner?

A
  • Class that contains methods to retrieve values from an input device
  • Each retrieved value is a token (set of characters) that is seperated from the next set by whitespace
18
Q

How do you use JOptionPane for input?

A

JOptionPane.showInputDialog(null, “message”, “title”, (class field describing type of input box)

19
Q

How do you use JOptionPane confirm dialoge box?

A

JOptionPane.showConfirmDialog(null, “message”, “title”

20
Q

What does the JOptionPane return?

A

JOptionPane.YES_OPTION
JOptionPane.NO_OPTION
JOptionPane.CANCEL_OPTION

21
Q

How are arithmetic expressions evaluated?

A
  • From left to right
  • First multiplication, division, and remainder
  • Then addition or subtraction
  • Can be overridden using paranthesis
22
Q

What is type conversion?

A

Converting one data type to another

23
Q

What is the unifying type?

A
  • the type in which all operands in an expression are automatically comvverted for compatability
  • Highest to lowest (double, float, long, and int)
24
Q

What is type casting?

A
  • Forces a value of one data type to be used as a value of a another type
  • Use cast operator