As in C++, a constructor in Java is indicated simply by naming a method the same as a class. It is used in much the same way as a constructor in C++.