Google Search

Monday, October 10, 2011

write a java program for operator overloading


import java.lang.*;
import java.io.*;
class sample
{
void add(int a,int b)
{
System.out.print("sum="+(a+b));
}
void add(int a,int b,int c)
{
System.out.print("Sum="+(a+b+c));
}
}
class overloading
{
public static void main(String args[])
{
sample s=new sample();
s.add(10,20,30);
}
}

0 comments:

Post a Comment