Conditional Operators and Statements

Flashcards by nini798, updated more than 1 year ago
Created by nini798 almost 6 years ago


Flashcards for conditional and relational operators/statements in java

Resource summary

Question Answer
== equals
<= smaller than or equals to
>= greater than or equal to
!= does not equal
< smaller than (exclusive)
> greater than (exclusive)
|| or
&& and
syntax of an if/else statement if(condition) { statements; } else { statements; }
Syntax of a switch & case statement switch(variable){ case value: statements; break; //optional case value: statements; ... }
Which 'if' will the 'else' pair up with? if(statement){ if(statement){ else{ } } } if(statement){ if(statement){ //this one else{ } } }
What data types will work with the variable creating a switch? int, byte, short, char, String (other types, but not very relevant to this class, are enumerated types and classes that "wrap" primitive data types, such as Integer, Byte, Short, Character)
else statements pair up with: the closest if statement that's available. (not available means that the if statement is locked outside of brackets of another, outer 'if' statement. See example below: if(statement){ //locking bracket if(statement){ } } //locking bracket else{ //outside of bracket }
Optional statements added after an 'if' statement else, else if
syntax for a nested 'if' statement if(condition){ if(condition){ } }
What is this equivalent to? !(A && B) !(A) || !(B)
What is this equivalent to? !(A || B) !(A) && (B)
De Morgan's Law not(A or B) == (not A) and (not B) as well as not(A and B) == (not A) or (not B)
break statement exits a switch statement
default statement used at the end of a switch statement, takes all values, implies that other cases weren't reached
case groups multiple cases that all run the same statement in a switch
Show full summary Hide full summary


Java Week 5 Object Oriented Programming
Troy Bowlin
Conditional and Relational Operators/Statements
French Tense Endings
James Hoyle
foundation of economics
Java Practice 1
Ummm No
Java Practice 1
Shamama's Corner
Spanish Tenses
Joe McElroy
Servion - Java Questionnaire
Java Core. Basics
Java Practice 2
Ummm No
French Tense Endings
Orlaith Walsh