Monday, 2 November 2020

(If statements) in JAVA

 

 (If statements)  in JAVA



 The  if statement :-

 An  if statement  consists of a boolean  expression  followed  by  one or more  statements. 


SYNTAX :-

   if ( Boolean   expression)

   {

      // statements will execute if the Boolean   expresion  is true


      }



If  the Boolean  expression  evaluates to true  then  the block  of code  inside  the if statement  will  be executed.  If  not  the  first  set  of code after the end  of the if  statement  ( after  the  closing  curly  brace ) will  be executed.



EXAMPLE :-


public  class Test

 {

    public static void main (String  args[] )            


     {

       int x  = 10;

       if(x< 20);

       {


    System .out. println (" This  is if statement ");



       }

 

   }


}



OUTPUT :

This  is if statement





No comments:

Post a Comment

Student Marks Calculation app using java

      import javax.swing. *; import java.awt.event.ActionEvent ; import java.awt.event.ActionListener ; public class Student { private J...