Home » Java programming language

Java Calendar setFirstDayOfWeek() Method with Example

Calendar Class setFirstDayOfWeek() method: Here, we are going to learn about the setFirstDayOfWeek() method of Calendar Class with its syntax and example.
Submitted by Preeti Jain, on February 02, 2020

Calendar Class setFirstDayOfWeek() method

  • setFirstDayOfWeek() method is available in java.util package.
  • setFirstDayOfWeek() method is used to sets the first day of the week.
  • setFirstDayOfWeek() method is a non-static method, it is accessible with the class object and if we try to access the method with the class name then we will get an error.
  • The return type of the method is void, it does not return anything.
  • setFirstDayOfWeek() method accepts only one parameter is of int type.
  • setFirstDayOfWeek() method does not throw an exception at the time of set first day of the week.


    public void setFirstDayOfWeek(int day);


  • int day – represents the value of the first day of the week.

Return value:

The return type of this method is void, it returns nothing.


// Java Program to demonstrate the example of
// void setFirstDayOfWeek(int day) method of Calendar

import java.util.*;

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

        // Instantiating a Calendar object
        Calendar ca = Calendar.getInstance();

        System.out.println("ca: " + ca.getTime());

        // By using setFirstDayOfWeek(int fi) method is to 
        // set the first day of the week of this Calendar

        // By using getFirstDayOfWeek() method is to
        // return the first day of the week
        int day = ca.getFirstDayOfWeek();

        // Display First day of the week
        System.out.println("ca.getFirstDayOfWeek(): " + day);


ca: Sun Feb 02 08:15:19 GMT 2020
ca.getFirstDayOfWeek(): 4


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.