现在的位置: 首页 > 综合 > 正文

关于构造函数的重载 用this语句的调用问题

2018年04月10日 ⁄ 综合 ⁄ 共 432字 ⁄ 字号 评论关闭

 

public class Overload
{
                   public Overload()
           {           

               this(3);
               System.out.println("gogogo");
             }
              public Overload(int i)
             {
                          System.out.println("GOGOGO");
             }
                 public static void main(String[] args)
          {
                 Overload ol = new Overload();
           }
 }

//打印为GOGOGO
  //    gogogo
//    此为关于构造函数重载与this 语句的调用问题

抱歉!评论已关闭.