If ,Else If and Else In Java
package com.company;
import java.util.Scanner;
public class tuts {
public static void main(String[] args) {
int age;
Scanner sc = new Scanner(System.in);
System.out.println("Please Enter Your Age:");
age = sc.nextInt();
if (age>=18){
System.out.println("Yes you can drive");
}
else if (age==14){
System.out.println("Wait for more 4 years to drive!");
}
else{
System.out.println("No you can drive yet.");
}
}
}
Comments
Post a Comment