JAVA SP T


Lets dive into snapshot of my programs!💻

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

💡Code:

 import java.util.Date;

              public class CurrentDate7078 {
              
                  public static void main(String[] args) {
                      // Accessing the java.util.Date class through qualified name
                      java.util.Date currentDate = new java.util.Date();
              
                      // Printing the current date
                      System.out.println("Current Date: " + currentDate);
                  }
              }
              

📸Output :

output