Tuesday, 10 June 2014

Constructor Chaining.

class Const
{
Const()
{
  System.out.println("This is Default Const of class");
}
Const(int a)
{
  this();
  System.out.println("This is Param1 Const of class");
}
Const(int a,int b,int c)
{
  this(c);
  System.out.println("This is Param2 Const of class");
}
public static void main(String []ars)
{
  Const obj = new Const(4,5,8);
}
}

No comments:

Post a Comment