Java - Write code to get current Month in int number

Requirements

Write code to get current Month in int number

Demo

import java.util.Calendar;

public class Main {
  public static void main(String[] argv) {
    System.out.println(getNowMonth());
  }//from w w w .j  ava2 s .c o  m

  public static int getNowMonth() {
    Calendar cc = Calendar.getInstance();
    return cc.get(Calendar.MONTH) + 1;
  }
}

Related Exercise