Thursday, October 13, 2011

Learn Core JAVA in Easy Steps [Page 5]





Conditional Constructs :-

  1. Switch
  2. If
  3. If Else
  4. If Else If ladder
  5. nested If

Looping :-
  1. While
  2. Do While
  3. For
  4. 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);

No comments:

Post a Comment