public class Flower{ 
            int i;
    Flower (int petals){}
            Flower(String ss){} 
            Flower(int petals, String ss){ 
                 //petals++;调用另一个构造函数的语句 
                 this(this.i);
                 //this(this.i);会产生错误                 this(ss);                //this(ss);会产生错误,因为在一个构造函数中只能调用一个构造函数 
            } 

解决方案 »

  1.   

    构造函数调用构造方法不对!你还真把构造函数党方法调用了,虽然他有这个功能,但是我仍然确定你不知道什么是构造函数 public class Flower
        {
            int i;
            Flower(int petals) { }
            Flower(String ss) { }
            Flower(int petals, String ss):this(petals)//调用签名是int类型的构造函数
            {          
            }
            Flower()
                : this("")//调用构造函数是字符串的构造函数
            { }
        }
      

  2.   

    ...
    函数里this是指向当前的实例,是已经创立了的对象
    至于在构造函数里调用其它构造函数的方法同4楼.
      

  3.   

    构造函数不能调用本身且不能在用this来调用,因为构造函数实质上是静态函数,不能用this这样代表对象的关键字来表示