Create a Java program to access the java.util.Date class through import keyword and print the current date of the system but inherit the Date class.

Source Code:

import java.util.Date;

public class InheritDateImport extends Date {
public static void main(String[] args) {
InheritDateImport obj = new InheritDateImport();
System.out.println(obj);
}
}

Output: