Conditional Operators and Statements

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

Description

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

Similar

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