Java异常解决 Constructor call must be the first statement in a c

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

当我在这个构造函数中调用其他构造函数时出现了这个错误

 public Busline(int id,String lineNum,String type,String startAndEndTime,   String company,String startRoute,String endRoute,   String mark,String other) {               this.id = id;  this(lineNum,type,startAndEndTime,    company,startRoute,endRoute,    mark,other); }

原来是构造函数必须放在第一行,这是哪门子规定啊,没办法,改过来吧!

 public Busline(int id,String lineNum,String type,String startAndEndTime,   String company,String startRoute,String endRoute,   String mark,String other) {  this(lineNum,type,startAndEndTime,    company,startRoute,endRoute,    mark,other);  this.id = id; }

这样就好了,又学习了。           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

你可能感兴趣的:(Java异常解决 Constructor call must be the first statement in a c)