Thursday, July 8, 2010

IF ELSE sample program

This program will determine the age of person if 18 above  or 18 below. the program will show message " Your qualified to vote" if the age of person is 18 above, else the program will show message " Your not qualified to vote" if the age of person is 18 below.

here is the sample program.

import java.io.*;

public class SampleIf
{
public static void main(String args[])
{
//declaration
int age=18;

if(age>=18)
   {
     System.out.println("Your Qualified to Vote");
    }
else
   {
    System.out.print("Your not Qualified to vote");
   }
}

}

No comments:

Post a Comment