A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Java code to print or display current system date

import java.util.*;
public class HelloWorld{

     public static void main(String []args){
        Calendar cal = Calendar.getInstance();
       
        int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
        System.out.println("day= "+dayOfMonth);
       
        int Month = cal.get(Calendar.MONTH);
        System.out.println("month= "+Month);

        year = cal.get(Calendar.YEAR);
        System.out.println("year = "+year);
   }
}


ouput:


LEARN TUTORIALS

.

.