Sunday, May 26, 2013

Date In Java

/***PROGRAM FOR DATE*/

import java.io.*;

class date
{
   int dd,mm,yy;

public void getdate()throws Exception
{
  int flag=0;
   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 
  while(flag==0)
   {
                   
       try
{
   System.out.println("ENTER THE DATE:");
     dd=Integer.parseInt(br.readLine());
     mm=Integer.parseInt(br.readLine());
     yy=Integer.parseInt(br.readLine());

flag=1;
}

catch(NumberFormatException ne)
  {
    System.out.println("Exception occured: INVALID NUMBER" +ne);
  }
                  };
               }

    public void putdate()
{
    System.out.println(dd+"/"+mm+"/"+yy);
}
 
           public static void main(String args[])throws Exception
       {
                      date d=new date();

                          d.getdate();
  d.putdate();
                  }
  }

No comments:

Post a Comment

MS SQL : How to identify fragmentation in your indexes?

Almost all of us know what fragmentation in SQL indexes are and how it can affect the performance. For those who are new Index fragmentation...