Table of contents
Operators In Java
- Arithmetic Operator example: -,+,/,*,%-----------/ gives quotient, % gives remainder
- Relation Operator----output is always boolean ie true or false <,>,<=,>=,==,!=
- logical Operator or-- ||, and -- &&, not -- !
Conditional Statements
if-else syntax: if(condition_true){
}else{ //when condition is false }
if-elseif ladder
syntax: if(condition_true){ }else if(condition_in_if fails_only_then){ }else{ //when both if and elsif fail
}
- switch case
switch(number){ case 1: default: }
if no break written all from case matched to default will be executed
Loops
1.while 2.do-while 3.for
a. while(condition_true){//we dont know the number of iteration}
b. for(int i=0;condition;I++){we know the number of iteration}
c. do-while---
first run is mandatory
do{ }while(condition)//go back to do when true else leave the loop