When a class contains a method named initialize this is automatically called when an object is created using the new method. It is a good idea to use an initialize method to set the values of an object’s instance variables. The new method creates an object. Ruby executes the initialize method immediately after a new object is created.