Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
class chk
{
public static void main(String args[])
{
int age;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter age :");
age=Integer.parseInt(x.readLine());
if(age>=18)
{
System.out.println("Eligible for vote");
}
else
{
System.out.println("Not Eligible for vote");
}
}
catch(Exception e)
{
}
}
}
=========================================================================
Output :
Enter age :
20
Eligible for vote.