1/9
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What method allows the programmer to have control over how numbers appeared when printed?
System.out.printf
Assuming the following code segment, which operator (placed in the position of the underlines, i.e. ) would cause this if statement to simplify to true and write "The result was true!" on the screen?
int x=4;
int y=5;
if (x==5 __ y==5){
System.out.println("The result was true!");
}
| |
What is wrong with the following code block?
if(x==4){;
System.out.println(“x was 4”);
}
There is an incorrect end of statement semicolon after the opening of the if statement
An if statement inside another if statement is known as a(n) _____
nested if statement
What statement/keyword allows you to test the value of a variable or expression and then use that value to determine which statement of set of statements to execute?
switch
____ is an example of a relational operator, while ____ is an example of a logical operator
< , &&
y - ( x > 0) ? 1 : -1;
is an example of a(n) ______
conditional operator
Assuming the following code:
String yourName="Phil";
String myName="Phil";
Given these statements, which answer demonstrates the proper way to see if the names are the same in an if statement?
if (yourName.equals(myName)){
System.out.println(“Our names are the same!”);
}
!, &&, || and ^ can be used to create a(n) _________
compound Boolean expression
Which of the following operators has the highest precedence?
&&
||
!
!