java-构造方法

基本概念
构建,也叫构造器,用来帮助创建对象的方法,准确的说,构造方法的作用是初始化对象
定义
格式:修饰符 构造方法名(参数列表){方法体}
## 要求:方法名必须与类名一样
        没有返回值(可以写return)
        没有返回值类型(不能写void)
注意事项
如果没有提供任何构造方法,系统会给出默认无参构造;构造方法可以重载
When nothing seems to help, I go look at a stonecutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before. -- Jacob Riis
原文地址:https://www.cnblogs.com/xhwy-1234/p/12274272.html