Thursday, October 13, 2011
Learn Core JAVA in Easy Steps [Page 5]
Conditional Constructs :-
- Switch
- If
- If Else
- If Else If ladder
- nested If
Looping :-
- While
- Do While
- For
- For each
--> Switch :=
switch(expression){case 1:statements;break;case 2:statements;break;....
default:statements;
}
--> If :=
if(condition){statements;}
--> If Else :=
if(condition){}else{}
--> If - Else - If :=
if(){
}else if(){
}else{
}
--> Nested If :=
if(){if()}{}
--> While :=
while(condition){
}
--> Do While :=
do{}while(condition)--> For :=
for(start, end, condition){}
--> For Each :=
for(String Devharsh:array)System.out.println(Devharsh);
Learn Core JAVA in Easy Steps [Page 4]
Operators:
1. Arithmetic
- Assignment
- Increment
- Decrement
2. Relational
- Boolean
3. Logical
- Short Circuit
- Long Circuit
Priority | Operators | Operation | Associativity |
---|---|---|---|
1 | [ ] | array index | left |
() | method call | ||
. | member access | ||
2 | ++ | pre- or postfix increment | right |
-- | pre- or postfix decrement | ||
+ - | unary plus, minus | ||
~ | bitwise NOT | ||
! | boolean (logical) NOT | ||
(type) | type cast | ||
new | object creation | ||
3 | * / % | multiplication, division, remainder | left |
4 | + - | addition, substraction | left |
+ | string concatenation | ||
5 | << | signed bit shift left | left |
>> | signed bit shift right | ||
>>> | unsigned bit shift right | ||
6 | < <= | less than, less than or equal to | left |
> >= | greater than, greater than or equal to | ||
instanceof | reference test | ||
7 | == | equal to | left |
!= | not equal to | ||
8 | & | bitwise AND | left |
& | boolean (logical) AND | ||
9 | ^ | bitwise XOR | left |
^ | boolean (logical) XOR | ||
10 | | | bitwise OR | left |
| | boolean (logical) OR | ||
11 | && | boolean (logical) AND | left |
12 | || | boolean (logical) OR | left |
13 | ? : | conditional | right |
14 | = | assignment | right |
*= /= += -= %= | combinated assignment (operation and assignment) | ||
Subscribe to:
Posts (Atom)