Skip to content
Related Articles

Related Articles

Calendar getFirstDayOfWeek() Method in Java with Examples

View Discussion
Improve Article
Save Article
  • Last Updated : 12 Jul, 2021
View Discussion
Improve Article
Save Article

The getFirstDayOfWeek() method in Calendar class is used to return the first day of the week of this Calendar.

public int getFirstDayOfWeek()

Parameters: The method does not take any parameters.
Return Value: The method returns the first day of the week.
Below programs illustrate the working of getFirstDayOfWeek() Method of Calendar class: 
Example 1: 


// Java code to illustrate
// getFirstDayOfWeek() method
import java.util.*;
public class Calendar_Demo {
    public static void main(String[] args)
        // Creating calendar object
        Calendar calndr = Calendar.getInstance();
        // Displaying the first
        // day of the week
        System.out.println("The First day"
                           + " is: " + calndr.getFirstDayOfWeek());
        int the_day = calndr.getFirstDayOfWeek();
        switch (the_day) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:


The First day is: 1



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!