有没有中间注释的,运行的结果都一样,求有无中间注释的区别在哪里?
class Vchicle
{
int passengers;
double weight;
String color;
Vchicle(int p,double w)
{
this(p,w,"WHITE"); //调用另一个构造函数
}
Vchicle(int p,double w,String c)
{
this.passengers=p;
this.weight=w;
this.color=c;
}
/**void setData(int passengers,double weight,String color)
{
this.passengers=passengers;
this.weight=weight;
this.color=color;
}*/
void outputVariables()
{
System.out.println(passengers+" "+weight+" "+color);
}
}
public class ThisDemo
{
public static void main(String args[])
{
Vchicle v1=new Vchicle(3,5.5,"WHITE");
v1.outputVariables();
Vchicle v2=new Vchicle(3,5.0);
v2.outputVariables();
}
}
[解决办法]
注释部分的方法没有被调用,注释和不注释肯定没区别啦
[解决办法]