Gaddis Chapter Two Review Questions
'A' is less than 'B'
How does the character 'A' compare to the character 'B'?
braces {}
To create a block of statements, you enclose the statements in these.
flag
This is a boolean variable that signals when some condition exists in the program.
nested if statement
This is an if statement that appears inside another if statement.
logical operators
&&, ||, and ! are _________.
True
All lines in a conditionally executed block should be indented one level.
False
The = operator and the == operator perform the same operation.
three
The conditional operator takes this many operands.
decision structure
The if statement is an example of a ____________.
True
The scope of a variable is limited to the block in which it is defined.
null statement
This an empty statement that does nothing.
the equals method
This determines whether two different String objects contain the same string.
relational operators
>, <, and == are
True
A conditionally executed statement should be indented one level from the if clause.
the closest previous if clause that doesn't already have its own else clause
An else clause always goes with __________.
default
This section of a switch statement is branched to if none of the case expressions match the switch expression.
boolean expression
This type of expression has a value of either true or false.
False
When an if statement is nested in the else clause of another statement, the only time the inner if statement is executed is when the boolean expression of the outer if statement is true.
True
When an if statement is nested in the if clause of another statement, the only time the inner if statement is executed is when the boolean expression of the outer if statement is true.
&&
When determining whether a number is inside a range, it's best to use this operator.
System.out.printf
You an use this method to display formatted output in a console window.