[Solved] When to call this() and when to call super() in java? [duplicate]


super() calls the parent constructor of the class and this() calls the constructor defined within the class.

//Example of super()
class parent
{
  parent()
  {

  }
}
class child()
{
   child()
   {
      super();   //Go to parent class constructor
   }
}


//Example of this    
class test
{
    test()
    {
       this("a");  //go to test one argument constructor within the test class
    }
    test(String a)
    {

    }

}

solved When to call this() and when to call super() in java? [duplicate]