Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
rk
Question of function overloading/overriding in java?
I have the following program in which a base class one and a derived class two, share the same method name m1 but differ in their arguments. I am not able to compile the program; it throws an error.
Can anybody help me?
class hello
{
public static void main(String args[])
{
one obj = new two();
int a1 = Integer.parseInt(args[0]);
obj.m1(a1);
String s1 = args[0]+args[0];
obj.m1(s1);
}
}
class one
{
void m1(float x)
{
System.out.println(x);
}
}
class two extends one
{
void m1(String s)
{
System.out.println(s);
}
}
2 AnswersProgramming & Design1 decade agocircle within a square and a square within that circle - ratio of areas of squares ?
A square of side a is drawn. Within that square, a circle of maximum size is cut out. Within that circle, a square, whose vertices are on the circle is drawn. Find the ratio of the areas of the first square and the second square. Options are:
a) 4
b) 3
c) 2
d) 0.5
9 AnswersMathematics1 decade ago