Conditional Statements if and else




This video tutorial explains the if and else conditional statements available in java programming.

You will learn what are the conditional statements available in java, how to execute some statements depending on some conditions, what is the syntax of if and how to use it, how to use the else part in detail with examples.



Source code for this video tutorial


package LearningJava;

public class Banana {
 public static void main(String[] args) {  
  int age = 25;
  
  if( age >= 18 ){
   System.out.println("Welcome to danceclub! Dont forget to do that cool move!!!");   
  }else{
   System.out.println("Go home kid");
  }
   System.out.println("dancing is fun");
 }

}



Back To Top