Java Tutorial 10 --- "If-else Statement in Java"

 Java Tutorial 10 --- "If-else Statement in Java"

DOC --- 


CODE --- 

package com.company;
import java.util.Scanner;

public class Tut10 {
public static void main(String[] args) {
// If-else Statement in Java

System.out.println("Enter your age --- ");
Scanner sc = new Scanner(System.in);
// int age = 20;
int age = sc.nextInt(); //Using Input function (Scanner class)

if(age>=18){
System.out.println("Yes boy you can drive.");
}
else{
System.out.println("No boy you cannot drive, not yet.");
}

}
}

Comments

Popular posts from this blog

JAVA Practice Set 2

Java Practice Set 4

Introduction to Java + Installing Java JDK and IntelliJ IDEA for Java