A constructor is a block of code that has the same name as the class and tells the computer how to create a new object.