posted 1 week ago
The first place to look when getting compiler errors from JDK library code is the JDK documentation. For example, if you'd looked at the JavaDoc for the Calendar class you'll have learned very quickly how to obtain a new instance.
Calendar JavaDoc wrote:Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time: