复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16public class QI { int qimax; public void QI(int qimax) { this.qimax=qimax; System.out.println("调用构造方法"); } } public class TEST { public static void main(String[] args) { // TODO Auto-generated method stub XIA xia=new XIA(); xia.setXiamax(100); xia.Do(); QI qi=new QI(1); } }
今天在练习构造方法的时候发现我在调用一个类的构造方法并给这个类属性赋值的时候 老是给我报错,以上是我还没有完成的代码!!!有人可以帮我解答一下吗?谢谢
最后
以上就是笨笨舞蹈最近收集整理的关于【构造方法】调用构造方法的全部内容,更多相关【构造方法】调用构造方法内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复