Tuesday, November 1, 2011

Java: int, double


I have worked with this file overload.class long time back.


class overloaddemo
{//start overloaddemo
    void test()
{//start test
    System.out.println("Hello World!");
}//end test
void test(int a)
 {//st test(int a)
   System.out.println("the value of a:"+" "+a);
 }//end test(int a)
void test (int a,int b)
{//st test(a,b)
 System.out.println("here a & b are:"+" "+a+" "+b);
}//end test(a,b)
double test(double a)
{//st test(double a)
  System.out.println("double a:"+" "+a);
  return a*a;
}//end test(double a)
 };//end overloaddemo
class overload
{
public static void main(String[] args)
{
overloaddemo ob = new overloaddemo();
double result;
ob.test();
     ob.test(10);
      ob.test(10,20);
      result = ob.test(123.2);
System.out.println("Hello World! result of ob is"+ result);
}
}

Post a Comment