GregorianCalendar getWeeksInWeekYear() in Java

getWeeksInWeekYear(): This method is available in java.util.GregorianCalendar class of Java.

Syntax:

int java.util.GregorianCalendar.getWeeksInWeekYear()

This method returns the number of weeks in the week year represented by this GregorianCalendar.

Parameters: NA

Returns: the number of weeks in the week year.

Exceptions: NA

Approach

Java

import java.util.GregorianCalendar;

public class GregorianCalendargetWeeksInWeekYear {
    public static void main(String[] args) {

        GregorianCalendar cal = new GregorianCalendar();

        System.out.println(cal.getWeeksInWeekYear());
    }
}

Output:

53


No comments:

Post a Comment