Java - Nested Statements, Switch Statments, and Boolean Operators

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

1/3

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

4 Terms

1
New cards
Nesting:
Putting one coding structure inside of another coding structure.

Ex: if (condition) {
if ( condition) {
statements;
} else {
statements;
} else {
statements;
}
2
New cards
Boolean opperators:
AND = &&
OR = ||
NOT = !

Ex: if (root == 2 || root == -2) {
statements;
}
3
New cards
If statements with multiple boolean opperators:
These need brackets:

Ex: if ( time == 6.0 || (day.equals ("Sunday") && time == 11.0)) {
4
New cards
Switch statement:
Used to have the program make a descicion. The condition for a switch statement must be an integer expression.

int dayOfWeek = 4;
Ex: switch (dayOfWeek) {
case 6:
System.out.println("Today is saturday!");
break;
case 7:
System.out.println("Today is sunday!");
break;
default:
System.out.println("Looking forward to the weekend!");
}

*default statement will print if dayOfWeek is anything other than 6 or 7*

Explore top flashcards

Land Use
Updated 289d ago
flashcards Flashcards (79)
nervous system
Updated 921d ago
flashcards Flashcards (79)
Formelle E-Mail
Updated 67d ago
flashcards Flashcards (58)
AP Art History 250
Updated 641d ago
flashcards Flashcards (250)
AP Govt Midterm
Updated 47d ago
flashcards Flashcards (116)
Spanish vocab
Updated 1006d ago
flashcards Flashcards (47)
Land Use
Updated 289d ago
flashcards Flashcards (79)
nervous system
Updated 921d ago
flashcards Flashcards (79)
Formelle E-Mail
Updated 67d ago
flashcards Flashcards (58)
AP Art History 250
Updated 641d ago
flashcards Flashcards (250)
AP Govt Midterm
Updated 47d ago
flashcards Flashcards (116)
Spanish vocab
Updated 1006d ago
flashcards Flashcards (47)