THIS KEYWORD IN CONSTRUCTOR OVERLOADING
THIS KEYWORD IN CONSTRUCTOR OVERLOADING
class show
{
int i;
char c;
show(int n,char c)
{i=n; this.c=c;
System.out.print("\n Number: "+i);
System.out.print("\n Char: "+c);
}
show(char c,int n)
{i=n; this.c=c;
System.out.print("\n Number: "+i);
System.out.println("\n Char: "+c);
}
public static void main(String at[])
{
show ob1=new show(1,'f');
show ob2=new show('s',2);
}
}
Comments
Post a Comment