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 av a  2 s  .  c om

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

Related Exercise