Sunday, July 12, 2009

Java Programmers can u pls help me..?

class A


{


void m1(A a)


{


System.out.print("A");


}


}





class B extends A


{


void m1(B b)


{


System.out.print("B");


}


}





class C extends B


{


void m1(C c)


{


System.out.print("C");


}


}





class D


{


public static void main(String[] args)


{


A c1 = new C();


B c2 = new C();


C c3 = new C();


C c4 = new C();


c4.m1(c1);


c4.m1(c2);


c4.m1(c3);


}


}





This is run-time error..i dont understand why is this error..can anyone explain wats the problem with this code..pls.

Java Programmers can u pls help me..?
Please tell us exactly what the runtime error was. Then I might be able to help.





I tried it on my computer and it prints out ABC .
Reply:no buddy its working fine...





try these steps





1)check wheteher the file name is the name of class that contains main


2)check whether you have set the CLASSPATH





hope you try these ... i am sure you get the output "ABC"

secret garden

No comments:

Post a Comment