java.util.Calendar getFirstDayOfWeek()

Description :

This java tutorial shows how to use the getFirstDayOfWeek() method of Calendar class of java.util package. This method gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.

Method Syntax :

public int getFirstDayOfWeek()

Parameter Input :

 

DataType Parameter Description
N/A N/A N/A

 

Method Returns :

This method returns the first day of the week.

Compatibility Version :

Requires Java 1.1 and up

Exception :

N/A

Java Code Example :

This java example source code demonstrates the use of getFirstDayOfWeek() method of Calendar class.

package com.javatutorialhq.java.examples;

import java.util.Calendar;

/*
 * This example source code demonstrates the use of  
 * getFirstDayOfWeek() method of Calendar class
 */

public class CalendarGetFirstDayOfWeekExample {

	public static void main(String[] args) {

		Calendar cal = Calendar.getInstance();
		System.out.println("Current first day of week:"
				+ cal.getFirstDayOfWeek());
		cal.setFirstDayOfWeek(Calendar.TUESDAY);
		System.out.println("New first day of week:" 
				+ cal.getFirstDayOfWeek());
	}
}

Sample Output :

Running the setFirstDayOfWeek(int value) method example source code of Calendar class will give you the following output:

Current first day of week:1
New first day of week:3

Exception Scenario :

N/A

Similar Method :

  • N/A

Suggested Reading List :

References :