376
This example gets the current date and time in Java using the Date() class
Example
import java.util.*; public class JavaApplication1 { public static void main(String[] args) { Date currDate = new Date(); System.out.println("Current date is " + currDate); } }
When you run this you will see the current date and time, this is what I saw was
run: Current date is Sun Apr 17 10:20:24 BST 2022