public class Constructor { public static void main(String[] args) { Month January = new Month("January", 31); //call constructor System.out.println(January.name + " " + January.length); System.out.println(January); //calls System.out.println(January.toString()); } } class Month { String name; int length; public Month(String n, int len) { //This method is the constructor. name = n; length = len; } /* //Another way to name the arguments of the constructor. public Month(String name, int length) { this.name = name; this.length = length; } */ public String toString() { return "name == " + name + ", length == " + length; } };