我有下面的Java代码。无法获得新时间
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String startFormattedDate = sdf.format(date);
System.out.println(startFormattedDate);
Thread.sleep(10000L);
String endFormattedDate = sdf.format(date);
System.out.println(endFormattedDate);
这里基本上我试图实现的是,打印当前时间,等待10秒钟,然后再打印时间。但令我惊讶的是,控制台在10秒后同时打印。请让我知道如何在等待10秒后获得时间。因为我需要根据两个时间做一些计算。