Write a Java program to create the package ‘date’ to display the tomorrow’s date.
package p1;import java.util.*;
class DateDemo
{
public static void main(String[] args)
{
Date now = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(now);
cal.add(Calendar.DAY_OF_YEAR, 1);
Date tomorrow = cal.getTime();
System.out.println(tomorrow);
}
}
0 comments:
Post a Comment