3:26 pm - Sunday June 25, 2017

Calendar in java example program getLeastMaximum(int field)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
 *@author: candidjava
 *@description: Calendar in java example program getLeastMaximum(int field)
 **/

import java.util.Calendar;

public class CalendarDemo {
	public static void main(String[] args) {
		// create a calendar
		Calendar cal = Calendar.getInstance();
		// get the days required in the first week of the year
		System.out.println("Months required: " + cal.get(Calendar.MONTH));
		// print the lowest maximum months for year.
		int max = cal.getLeastMaximum(Calendar.MONTH);
		System.out.println("Lowest maximum months :" + max);
	}
}

Output:

Months required: 9
Lowest maximum months : 11

BACK

Filed in: Z-A All Java Codes

Comments are closed.