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

Popular posts from this blog

SAME NAME IN CLASS METHOD AND CONSTRUCTOR

PALINDROME NUMBER

FIBONACCI SERIES