
write a java program to display present date and after 25days what will be the date?

import java.util.*;
import java.text.*;
class FindDate{
public static void main(String[] args){
Date today = new Date();
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy");
String presentDate=sdf.format(today);
System.out.println("Current Date: "+presentDate);
Calendar cal = new GregorianCalendar();
cal.setTime(today);
cal.add(Calendar.DAY_OF_MONTH, 25);
Date newDate = cal.getTime();
String date=sdf.format(newDate);
System.out.println("Date after 25 days: "+date);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.