This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Why this code encounters ambiguity error...
Posted by ruchi and hema on November 04, 2000 at 6:34 AM
class a{ static int i; static float g; static void main(int k){ System.out.println(k+ " from a ");} } class b extends a{ static void main(float f){ System.out.println(f+ " from b class");} } class c1 extends b{ static void main(int f){ System.out.println(f+" from c1"); } void main(String a) { System.out.println(a+ " from c1 second"); } static void main(String a1[]){ b obj =new c1(); int a=3; obj.main(a); } } NOTE: when we have created an object of class as a obj = new c1(); obj.main(a); The code works perfectly...but in the abouve code we found ambiguity error.. ANTICIPATING SOLUTION!!!!!!!!!
Replies:
|