Intro to Java Review Questions Chpt 3

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

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.

10 Terms

1
New cards

What method allows the programmer to have control over how numbers appeared when printed?

System.out.printf

2
New cards

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!");
}

| |

3
New cards

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

4
New cards

An if statement inside another if statement is known as a(n) _____

nested if statement

5
New cards

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

6
New cards

____ is an example of a relational operator, while ____ is an example of a logical operator

< , &&

7
New cards

y - ( x > 0) ? 1 : -1;

is an example of a(n) ______

conditional operator

8
New cards

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!”);

}

9
New cards

!, &&, || and ^ can be used to create a(n) _________

compound Boolean expression

10
New cards

Which of the following operators has the highest precedence?
&&
||
!

!