Conditional Operators and Statements

Description

Flashcards for conditional and relational operators/statements in java
nini798
Flashcards by nini798, updated more than 1 year ago
nini798
Created by nini798 about 9 years ago
25
1

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
Java Practice 1
Ummm No
foundation of economics
09serukenyahol
Spanish Tenses
Joe McElroy
Servion - Java Questionnaire
rohit.benedict
Java Practice 2
Ummm No
Java Core. Basics
Gadget
Chapter 3 & 4 Review
Shannon Anderson-Rush
Programming Review
Shannon Anderson-Rush