http://www.technicalpage.net/search/label/SQL

>> " if else" ," if elseif " ," if elseif else " statements in Java / Selenium


if else , if elseif , if elseif else statements in Java / Selenium

" if else " Statement
              String day = "Sunday";
             
              if (day=="Sunday") {
                     System.out.println("Today is Sunday.");
              } else {
                     System.out.println("Today is other than Sunday.");
              }
             
Answer : Today is Sunday.

              String day = "Monday";
             
              if (day=="Sunday") {
                     System.out.println("Today is Sunday.");
              } else {
                     System.out.println("Today is other than Sunday.");
              }
             
Answer : Today is other than Sunday.


" if elseif " Statement
              String day = "Monday";
             
              if (day=="Sunday") {
                     System.out.println("Today is Sunday.");
              } else if (day=="Monday") {
                     System.out.println("Today is Monday.");
              }
             
Answer : Today is Monday.

"if elseif else " Statement

       String day = "Tuesday";
             
              if (day=="Sunday") {
                     System.out.println("Today is Sunday.");
              } else if (day=="Monday") {
                     System.out.println("Today is Monday.");
              }  else  {
                     System.out.println("Today is other than Sunday or Monday.");
              } 

Answer : Today is other than Sunday or Monday.

No comments:

Post a Comment