• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/11

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

11 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
Block IF statements (part 2)
Remember that when the curly braces are not used, then only the next statement after the if condition will be executed conditionally.
if (expression)
statement1;
statement2;
statement3;
What is a Flag?
a boolean variable that monitors some condition in a program
How do you test characters?
•Characters can be tested with relational operators.
•Characters are stored in memory using the Unicode character format.
•Unicode is stored as a sixteen (16) bit number.
•Characters are ordinal, meaning they have an order in the Unicode character set.
•Since characters are ordinal, they can be compared to each other.
char c = ′A′;
if(c < ′Z′)
System.out.println("A is less than Z");
What is the purpose of IF-ELSE statements?
if-else statement adds the ability to conditionally execute code when the if condition is false
if (expression)
statementOrBlockIfTrue;
else
statementOrBlockIfFalse;
What is a 'Nested IF-ELSE' statement?
If an if statement appears inside another if statement (single or block) it is called a nested if statement.
•The nested if is executed only if the outer if statement results in a true condition.
Curly brace use is not required if there is only one statement to be conditionally executed.
•However, sometimes curly braces can help make the program more readable.
•Additionally, proper indentation makes it much easier to match up else statements with their corresponding if statement.
if (coldOutside)
{
if (snowing)
{
wearParka();
}
else
{
wearJacket();
}
}
else
{
wearShorts();
}
Methods

What is the purpose of a Method?
Used to break a problem down into small manageable pieces.

Methods simplify programs. If a specific task is performed in several places in the program, a method can be written once to perform that task, and then be executed anytime it is needed. This is known as code reuse.
Methods

What is a Void method?
simply performs a task and then terminates.
Methods

What is a Method Header?
appears at the beginning of a method definition, lists several important things about the method, including the method’s name.

Parts of a Method Header

Method Modifier
public static

Return type
void
Method Name
displayMessage ( )
{
System.out.println("Hello");
}
Methods

What is the Method Body?
a collection of statements that are performed when the method is executed.
Methods

What is an Argument?
Values that are sent into a method are called arguments.

The data type of an argument in a method call must correspond to the variable declaration in the parentheses of the method declaration. The parameter is the variable that holds the value being passed into a method.
Methods

What are the parts of the Method?