Method and if Statment (day-7)

What is method:
            Method is a sequence of instructions with the name. 
            Main method is a execution starting point. 
Ex:
     OpenEclipse() { 
            1.start on
            2. Eclipse type
            3.click the button
            4.launch
         }
Modularity:
          Modularity  To the concept of making multiple  first and then linking and combining them to From a complete system. 
Use:editing easy and make easy to run program. 
Method calling:
               method returns a value or  returning nothing (no return value). 
Ex: robot.calculateTotal();
Object creation:
                 MyObject obj =newMyObject();
Code Resuability:
You can use the same fields and methods already defined in the previous class.
If statement:
Use the if statement to specify a block of Java code to be executed if a condition is true.
Synatx:
if (condition) {  
// block of code to be executed if the condition is true
}
If else statement:
Use the else statement to specify a block of code to be executed if the condition is false.
syntax: 
if (condition) {
  // block of code to be executed if the condition is true
} 
else {  
// block of code to be executed if the condition is false
}
Nested if statement:
It is always legal to nest if-else statements which means you can use one if or else if statement inside another if or else if statement.
syntax: 
if(Boolean_expression 1) {
   // Executes when the Boolean expression 1 is true   if(Boolean_expression 2) {   
   // Executes when the Boolean expression 2 is true   
}
}
 References by=w3 schools. Com and tutorial point. Com

Leave a comment

Design a site like this with WordPress.com
Get started