title: How to execute multiple constructor, when creating single object
body: <p>I want to execute multiple constructor, while creating a single object. For example, I have a class definition like this-</p>
  
  <pre><code>public class Prg
  {
      public Prg()
      {
          System.out.println("In default constructor");
      }
      public Prg(int a)
      {
          System.out.println("In single parameter constructor");
      }
      public Prg(int b, int c)
      {
          System.out.println("In multiple parameter constructor");
      }
  }
  </code></pre>
  
  <p>And I am trying to achieve it by the following code - </p>
  
  <pre><code>public class Prg
  {
      public Prg()
      {
          System.out.println("In default constructor");
      }
      public Prg(int a)
      {
          Prg();
          System.out.println("In single parameter constructor");
      }
      public Prg(int b, int c)
      {
          Prg(b);
          System.out.println("In multiple parameter constructor");
      }
      public static void main(String s[])
      {
          Prg obj = new Prg(10, 20);
      }
  }
  </code></pre>
  
  <p>But in this case it is generating errors like -</p>
  
  <pre><code>Prg.java:11: error: cannot find symbol
              Prg();
              ^
    symbol:   method Prg()
    location: class Prg
  Prg.java:16: error: cannot find symbol
              Prg(b);
              ^
    symbol:   method Prg(int)
    location: class Prg
  2 errors
  </code></pre>
  
  <p>Thanks</p>