FileDocCategorySizeDatePackage
PrimitiveOverloading.javaAPI DocExample4965Mon Apr 06 18:10:26 BST 1998None

PrimitiveOverloading

public class PrimitiveOverloading extends Object

Fields Summary
Constructors Summary
Methods Summary
voidf1(char x)

 prt("f1(char)"); 
voidf1(byte x)

 prt("f1(byte)"); 
voidf1(short x)

 prt("f1(short)"); 
voidf1(int x)

 prt("f1(int)"); 
voidf1(long x)

 prt("f1(long)"); 
voidf1(float x)

 prt("f1(float)"); 
voidf1(double x)

 prt("f1(double)"); 
voidf2(short x)

 prt("f2(short)"); 
voidf2(int x)

 prt("f2(int)"); 
voidf2(long x)

 prt("f2(long)"); 
voidf2(float x)

 prt("f2(float)"); 
voidf2(double x)

 prt("f2(double)"); 
voidf2(byte x)

 prt("f2(byte)"); 
voidf3(short x)

 prt("f3(short)"); 
voidf3(int x)

 prt("f3(int)"); 
voidf3(long x)

 prt("f3(long)"); 
voidf3(float x)

 prt("f3(float)"); 
voidf3(double x)

 prt("f3(double)"); 
voidf4(int x)

 prt("f4(int)"); 
voidf4(long x)

 prt("f4(long)"); 
voidf4(float x)

 prt("f4(float)"); 
voidf4(double x)

 prt("f4(double)"); 
voidf5(long x)

 prt("f5(long)"); 
voidf5(float x)

 prt("f5(float)"); 
voidf5(double x)

 prt("f5(double)"); 
voidf6(float x)

 prt("f6(float)"); 
voidf6(double x)

 prt("f6(double)"); 
voidf7(double x)

 prt("f7(double)"); 
public static voidmain(java.lang.String[] args)

    PrimitiveOverloading p = 
      new PrimitiveOverloading();
    p.testConstVal();
    p.testChar();
    p.testByte();
    p.testShort();
    p.testInt();
    p.testLong();
    p.testFloat();
    p.testDouble();
  
static voidprt(java.lang.String s)

 
    System.out.println(s); 
  
voidtestByte()

    byte x = 0;
    prt("byte argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);
  
voidtestChar()

    char x = 'x";
    prt("char argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);
  
voidtestConstVal()

    prt("Testing with 5");
    f1(5);f2(5);f3(5);f4(5);f5(5);f6(5);f7(5);
  
voidtestDouble()

    double x = 0;
    prt("double argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);
  
voidtestFloat()

    float x = 0;
    prt("float argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);
  
voidtestInt()

    int x = 0;
    prt("int argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);
  
voidtestLong()

    long x = 0;
    prt("long argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);
  
voidtestShort()

    short x = 0;
    prt("short argument:");
    f1(x);f2(x);f3(x);f4(x);f5(x);f6(x);f7(x);