Friday, April 12, 2013

Selenium : To calculate age of a person

                                                    To calculate age of a person



import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.swing.JOptionPane;

public class Calculate_age
{
 public static void main(String[] args)
 {
  Date oDt=new Date();
  int iYear=Integer.parseInt(JOptionPane.showInputDialog(null, "Enter birth year"));
  JOptionPane.showMessageDialog(null,(oDt.getYear()+1900)- iYear);  
 }
}
 

No comments:

Post a Comment