designer class to overload function compare( ) as follows
void compare (int, int)
void compare ( char,char)
Answers
Answered by
2
Answer:
import java.io.*;
class Compare
{
static void compare (int A,int B)
{
if(A>B)
System.out.println(A+" is greater than "+B);
else
System.out.println(B+" is greater than "+A);
}
static void compare (char a, char b)
{
int x = (int) a;
int y = (int) b;
if (x>y)
{
x = (char) x;
System.out.println(x);
}
else
{
y = (char) y;
System.out.println(y);
}
}
}
Similar questions