"I'm not back." - Bill Harding, Twister
Following works.. Why...
class super1{
}
class sub1 extends super1
{
void amethod(int i)
{
System.out.println("int value");
}
void amethod(long i)
{
System.out.println("long value");
}
public static void main(String a[])
{
new sub1().amethod(10);
}
}
Originally posted by avn:
i am sorry .Here is the correct code:
class super1{
void amethod(int i){
System.out.println("int value");
}
}
class sub extends super1
{
void amethod(long i){
System.out.println("long value");
}
public static void main(String a[])
{new sub().amethod(10);
}
}
Error as ambiguous reference to amethod
[This message has been edited by avn (edited August 10, 2000).]
Originally posted by Rajesh Gupta:
This change works:
class super1{
public void amethod(long i){
System.out.println("long value");
}
}
class sub extends super1
{
public void amethod(int i){
System.out.println("int value");
}
public static void main(String a[])
{
new sub().amethod(10);
}
}
"I'm not back." - Bill Harding, Twister
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |