/***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();
}
}
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