Providing Constructors for Your Classes 为类提供构造方法
A class contains constructors that are invoked to create objects from the class blueprint. Constructor declarations look like method declarations—except that they use the name of the class and have no return type. For example, Bicycle
has one constructor:
类包含可被调用的构造方法,用于从类蓝图创建对象。构造方法声明看起来像方法声明 —— 只是,它们使用类的名称并且没有返回类型。例如,Bicycle
有一个构造方法:
public Bicycle(int startCadence, int startSpeed, int startGear) {