Thursday, March 14, 2019

Java - Control Statements


Java is a very powerful programming language and it is platform independent.Training is
provided in Java Training Institute in chennai,we can you give you a quality of training.
Java is used in both web and mobile application


Control Statements:
Core Java Training in chennai Control Statements are divided into many types,
they are:
1)If Statement
2)If..else Statement
3)If..elseif Statement
4)Nested if Statement
5)Switch Statement


1)If Statement:
If statement will only execute if the given condition is true.
Syntax:
if(condition) {
//codes;
}


2)If..else Statement:
If the given condition is false then the if..else statement will be execute.Java Course
and Certification
Syntax:
if(condition) {
//codes;
}
else {
//codes;
}


3)If..else if Statement:
The if..else if Statement will check the multiple statements with one condition.
Syntax:
If (condition) {
//codes;
} else if (condition) {
//codes;
} else if (condition) {
//codes;
}
else {
//codes;
}


4) Nested if Statement:
1.The Nested Java Course in Chennai if Statement has two if statements,they are inner
if statement and outer if statement
2.the inner if statements will only execute when the outer if statements is true.
Syntax:
If (condition){    
    //code to be executed    
         if(condition){  
            //code to be executed    
   }
}  


5)Switch Statements:
Switch statements will execute the statements with multiple conditions.
Syntax:
switch(expression){    
case value1:    
//code to be executed;    
break;  //optional  
case value2:    
//code to be executed;    
break;  //optional  
......    
   
default:     
code to be executed if all cases are not matched;    
}   
Note:
1) The case doesn't generally need request 1, 2, 3, etc. It can have any whole number an incentive
after case catchphrase. Additionally, a case shouldn't be in a climbing request dependably, you
can determine them in any request dependent on the necessity.
2) You can likewise Best Java Training Institute in chennai utilize characters in the switch case.
3) The articulation given inside switch should result in a consistent esteem else it would not be legitimate.

4) Nesting of switch explanations are permitted, which implies you can have switch proclamations
inside another switch. Anyway settled switch proclamations Java Classes in chennai ought to be kept
away from as it makes program increasingly intricate and less discernible.

                     
               Looping Statements in Java
The Looping statements are classified into three types,they are:
1)For Loop
2)while Loop
3)do while Loop
For Loop:
For loop are used to iterate the function repeatedly until the condition return true.
Syntax:
for(initialization;condition;incr/decr){  
//statement or code to be executed  
}  
While Loop:
1)While loop will not check the condition it directly execute the function.
2)After the execution it will check the condition.
Syntax:
while(condition){  
//code to be executed  
}  
Do..while Loop:
do..while loop will check the condition first then it will execute the program.
Syntax:
do{  
//code to be executed  
}while(condition);  
Break Statement:
1)Break Core Java Training in chennai are used in  the switch statements to terminate
the particular function.
2)the function of break is to terminate the particular loop and jump to next statement.
Syntax:
Break;

Continue Statement:
Continue statements are used to skip the function.
Syntax:
Continue;




No comments:

Post a Comment