INTEGRATIVE PROGRAMMING LESSON 4: MAKING DECISIONS, LOOPING, ARRAYS AND HANDLIG EXCEPTIONS

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/58

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

59 Terms

1
New cards

IF STATEMENT

The simplest statement you can use to make

a decision is the

2
New cards

SINGLE ALTERNATIVE SELECTION

OTHER TERM FOR IF STATEMENT

3
New cards

SINGLE ALTERNATIVE SELECTION

because there is only one

alternative-the true alternative.

4
New cards

DOUBLE EQUAL SIGN

WHAT IS THE JAVAS EQUIVALENCY OPERATOR

5
New cards

DOUBLE EQUAL SIGN

is used to determine equality;

6
New cards

IF ELSE

provides the mechanism to

perform one action when a Boolean

expression evaluates as true and a

different action when a Boolean

expression evaluates as false.

7
New cards

DUAL ALTERNATIVE

In other words, you use an if...else

statement for a dual-alternative

selection.

8
New cards

TRUE

To execute more than one statement

that depends on the evaluation of a

Boolean expression, you use a pair of

curly braces to place the dependent

statements within a block.

9
New cards

TRUE

When you block statements, you must remember that any variable

you declare within a block is local to that block.

10
New cards

SWITCH STATEMENT

is useful when you need to test a single variable

against a series of exact integer

11
New cards

SWITCH

starts the statement and is followed immediately by a test

expression enclosed in parentheses.

12
New cards

CASE

is followed by one of the possible values for the test expression

and a colon.

13
New cards

BREAK

optionally terminates a switch statement at the end of each case.

14
New cards

DEFAULT

optionally is used prior to any action that should occur if the

test variable does not match any case.

15
New cards

CONDITIONAL OPERATOR

requires three expressions separated with a question mark and a

colon; it is used as an abbreviated version of the if else statement.

16
New cards

CONDITIONAL OPERATOR

it is simply a convenient shortcut.

17
New cards

NOT OPERATOR

to negate the result of any Boolean

expression.

18
New cards

TRUE

Any expression that evaluates as

true becomes false when preceded

by the NOT operator, and

accordingly, any false expression

preceded by the NOT operator

becomes true.

19
New cards

LOOP

is a structure that allows repeated execution of a block of

statements.

20
New cards

LOOP BODY

a block of statements called the

21
New cards

BOOLEAN EXPRESSION

Within a looping structure, a — —- is evaluated.

22
New cards

SINGLE STATEMENT, BLOCK OF STATEMENT

The loop body can be a

— —-, or a —— between curly braces.

23
New cards

ITERATION

One execution of any

loop is called an

24
New cards

TRUE

As long as the loop-controlling, Boolean expression is true, the

statements in the loop body continue to execute. When the

Boolean evaluation is false, the loop ends.

25
New cards

WHILE LOOP

in which the loop-controlling

Boolean expression is the first statement in the

loop, evaluated before the loop body ever

executes

26
New cards

FOR LOOP

which is usually used as a concise

format in which to execute loops

27
New cards

DO WHILE LOOP

in which the loop-controlling

Boolean expression is the last statement in the

loop, evaluated after the loop body executes one

time.

28
New cards

DEFINITE LOOP OR COUNTED LOOP

A loop that executes a specific number of times is a

29
New cards

INDEFINTE LOOP

Sometimes a programmer does not know how many times a

loop will execute because the number of iterations is determined while the

program is running. Such a loop is an

30
New cards

EVENT CONTROLLED LOOP

the value of a loop control variable is not altered by adding to

it or subtracting from it, but instead is altered by some other event.

Such a loop is an

31
New cards

EVENT CONTROLLED LOOP

is a type of indefinite loop because you

don't know how many times it eventually will repeat during each

program execution.

32
New cards

FOR LOOP

is a special loop that is convenient to use when a definite

number of loop iterations is required; it provides a concise way to

create a counter-controlled loop.

33
New cards

FOR LOOP

provides you with a shorthand notation for this type of

loop.

34
New cards

ARRAY

is a named list of data items that all have the same data type.

35
New cards

DATA ITEM

Each — —- is an element of the array.

36
New cards

ARRAY LIST

that

can be used to create containers that store lists of objects.

37
New cards

ARRAY LIST

is dynamically resizable, meaning

that its size can change during program execution.

38
New cards

EXCEPTION

is an unexpected or error condition.

39
New cards

EXCEPTION HANDLING

is the name for the object-oriented techniques

that manage or resolve such errors.

40
New cards

RUNTIME ERROR

Unplanned exceptions that occur

during a program's execution are also called

41
New cards

ERRORS AND EXCEPTION

Java includes two basic classes of errors: WHAT IS IT? AND IT IS IN THROWABLE CLASS

42
New cards

OBJECT CLASS

which is defined in the automatically imported

java.lang package

43
New cards

CATCH BLOCK

is a segment of code that can handle an exception that

might be thrown by the try block that precedes

44
New cards

THROWN STATEMENT

is one that sends an Exception object out of a

block or a method so that it can be handed elsewhere.

45
New cards

CATCH BLOCK

A thrown

Exception can be caught by a

46
New cards

TRY

a procedure that might cause

an error.

47
New cards

THROWS

A method that detects an error condition “——” an

exception,

48
New cards

CATCH

and if you write a block of code that processes the error, that

block is said to , “—-” the exception.

49
New cards

UNCHECKED EXCEPTIONS

These exceptions inherit from the Error

class or the RuntimeException class.

50
New cards

CHECKED EXCEPTIONS

These exceptions are the type that

programmers should anticipate and from which programs should

be able to recover.

51
New cards

CHECKED EXCEPTIONS

All exceptions that you explicitly throw and

that descend from the Exception class are — —-

52
New cards

TRUE

You can provide any legal identifier you want for an array,

53
New cards

TRUE

programmers conventionally name arrays by following the same rules they

use for variables—array names start with a lowercase letter and use

uppercase letters to begin subsequent words.

54
New cards

TRUE

When you use the keyword new to define an array, the array

reference acquires a memory address value.

55
New cards

TRUE

You also can assign nondefault values to array elements upon

creation.

56
New cards

TRUE

Just as you can declare arrays of

simple types such as int or double,

you can declare arrays that hold

elements of objects.

57
New cards

TRUE

To construct an array of objects using a default constructor, you must

still call the constructor using the keyword new for each declared array

element.

58
New cards

TRUE

To use a method that belongs to an object that is part of an array,

you insert the appropriate subscript notation after the array name

and before the dot that precedes the method name

59
New cards

ARRAY LIST

An — —- can hold any type of object;