Here’s my code below:
public class Question
{
public static void main(String args[])
{
int year;
Calendar current = Calendar.getInstance(); //Creating the calendar class object
year = current.get(Calendar.YEAR); //Initializing year with calendar class object
System.out.println ("Current Year: "+year); // Printing year
}
}
The above code runs when I import java.util.Calendar. I want this to run without having to import java.util package.
How to use the calendar class in Java without importing any package?