Q:

Java - Constructor Overloading

0

This Program in used to demonstrate the Constructor Overloading concept.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

class consov

 {

    consov(int a, int b)

    {

      System.out.println("\ninteger value : "+(a+b));

    }

    consov(double a, double b)

    {

      System.out.println("\ndouble value : "+(a+b));

    }

    consov(float a, float b)

    {

      System.out.println("\nfloat value : "+(a+b));

    }

    consov(byte a, byte b)

    {

      System.out.println("\nbyte value : "+(a+b));

    }

    consov(short a, short b)

    {

      System.out.println("\nshort value : "+(a+b));

    }

    consov(long a, long b)

    {

      System.out.println("\nlong value : "+(a+b));

    }

    consov(String a, String b)

    {

      System.out.println("\nstring value : "+(a+b));

    }

    public static void main(String arg[])

     {

       consov t1,t2,t3,t4,t5,t6,t7;

       t1 = new consov(5,10);

       t2 = new consov(10.3,14.2);

       t3 = new consov(5.3,3.2);

       t4 = new consov(100,-50);

       t5 = new consov(10000,-20000);    

       t6 = new consov(250,200);

       t7 = new consov("ssv","ksv");

     }

  }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now