import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class CurrentDateExample {
public static void main(String[] args) {
// Get the current date
LocalDate currentDate = LocalDate.now();
// Define the date format
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
// Format the date and store it in a variable
String formattedDate = currentDate.format(formatter);
// Print the formatted date
System.out.println("Current date in DD-MM-YYYY format: " + formattedDate);
}
}