Java

Java Branching Statement - if-else statement

Java Branching Statement - if-else statement
import java.io.*; 

class ssvif 
{ 
   public static void main(String arg[]) throws IOException 
    { 
       System.out.print("Enter your age in completed years: "); 

       DataInputStream dr = new DataInputStream(System.in); 

       String t; 

       t = dr.readLine();

       int age = Integer.parseInt(t); 

       if(age >= 18) 
          System.out.println("\nyou are eligible to cast your vote"); 
             else 
         System.out.println("\nyou have to wait for " + (18-age) + " years"); 
    } 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.