Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Calendar;

public class Main {

    public static int getCurrentSeason() {
        Calendar c = Calendar.getInstance();
        int month = c.get(Calendar.MONTH);
        if (month >= 0 && month < 3) {
            return 1;
        } else if (month > 3 && month < 6) {
            return 2;
        } else if (month > 6 && month < 9) {
            return 3;
        }
        return 4;
    }
}