I created the following program that transforms a numerical month into the corresponding textual month. I initially calculated the starPoint and endPoint in the class constructor; then I changed that calculation to the getName method. Which is a better option? Calculating in the class constructor, or in a separate method like shown in the code?/** * Created by Robert Holland on 25/11/2016. * * A class that accepts a number and calculates * the corresponding month. Once the month has * been calculated it will then be returned. * */public class Month{    public static final String MONTHS = January    + February   + March      +                                        April      + May        + June       +                                        July       + August     + September  +                                        October    + November   + December  ;    private int monthNumber;    //Construct a month class that has a value equal to the numerical month    //@param uMonthNumber the number of the month to find the correspondance.    public Month(int uMonthNumber)    {        monthNumber = uMonthNumber;    }    //Determine the name that corresponds to the month number.    //@return month the name of the corresponding month.    public String getName()    {        String month;        int startPoint;        int endPoint;        endPoint = monthNumber * 10;        startPoint = endPoint - 10;        month = MONTHS.substring(startPoint, endPoint);        return month;    }}
Computing the name of the month
java;beginner;datetime