Posts

Showing posts with the label If-else Statement

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

Image
 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." ) ; } } }