Decision Making Structures

Primary tabs

Abdelraheem Al-najjar Raheem's picture

No Description Set

Subjects: 

Bookmark to learn: Login to use bookmarks.

Bookmark to learn: Login to use bookmarks.

Add to collection ... add Decision Making Structures to your collections:

Help using Flashcards ...just like in real life ;)

  1. Look at the card, do you know this one? Click to flip the card and check yourself.
  2. Mark card Right or Wrong, this card will be removed from the deck and your score kept.
  3. At any point you can Shuffle, Reveal cards and more via Deck controls.
  4. Continue to reveal the wrong cards until you have correctly answered the entire deck. Good job!
  5. Via the Actions button you can Shuffle, Unshuffle, Flip all Cards, Reset score, etc.
  6. Come back soon, we'll keep your score.
    “Repetition is the mother of all learning.”
  7. Signed in users can Create, Edit, Import, Export decks and more!.

Bookmark to learn: Login to use bookmarks.

Share via these services ...

Email this deck:

Right: #
Wrong: #
# Right & # Wrong of #

Have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

Decision Making Structures

Back image: 

What 4 decision making statements does java programming language provide?

1. if statement
2. if.,else statement
3. nested if statement
4. switch statement

An if statements consists of a - expression followed by one or more statements

Boolean

If the Boolean expression evaluates to true then the block of code inside the - will be executed.

if statement

What is else if...else statement useful for?

To test various conditions using single if...else if statement.

An if can have - or one else's and it must come after any else if's.

zero

An if can have zero to many else if's and they must come - the else.

before

Once an else if succeeds, none of the remaining else if's or else's will be -

tested.

A statement that allows a variable to be tested for equality against a list of values.

SWITCH statement

Each value in a switch statement is called a -

Case

What are the 4 types of variables that a switch statement can be?

1. integers,
2. convertable integers (byte, short, char),
3. strings
4. and enums

You can have any number of case statements within a -. Each case is followed by the value to be compared to and a colon.

switch

The value for a case must be the same data type as the variable in the switch and it must be a x or a y.

constant or a literal

When the variable being switched on is equal to a case, the statements following that case will execute until a - is reached.

break statement

When a break statement is reached, the switch terminates, and the flow of control jumps to the next line following the -

switch statement

Not every case needs to contain a break. If no break appears, the flow of control will fall through to subsequent cases until a - is reached.

break

A switch statement can have an optional -, which must appear at the end of the switch. The - can be used for performing a task when none of the cases is true. No break is needed in the -.

default case

Subjects: