Hi I tried the code below bt getting compile error which says:
-------------------------------------------------
SubClass5.java:29: incompatible types
found : SubClass5
required: A.SuperClass
SuperClass sb = new SubClass5();
--------------------------------------------------
interface A{
void methodItfA();
abstract class SuperClass {
abstract public void doIt();
void checkImpl(){
System.out.println("superclas5 checkImpl()");
}
}}
public class SubClass5 extends SuperClass implements A{
public void doIt()
{
System.out.println("subclas5 doIt()");
}
public void methodItfA()
{
System.out.println("subclas5 methodItfA()");
}
public static void main(
String... args)
{
SuperClass sb = new SubClass5();
sb.doIt();
sb.checkImpl();
A ObjA = new SubClass5();
ObjA.methodItfA();
}
}
Further when I use
SuperClass.A.methodItfA();
I get more errors such as
SubClass5.java:29: incompatible types
found : SubClass5
required: A.SuperClass
SuperClass sb = new SubClass5();
^
SubClass5.java:35: cannot find symbol
symbol : variable A
location: class A.SuperClass
SuperClass.A.methodItfA();
^
How to correct n call methodItfA() in my code.....
Please explain what is actually happening
SOURCE: I didn't get this as mock I was trying to dig the concept
[ December 16, 2008: Message edited by: plenitude gupta ]
[ December 16, 2008: Message edited by: plenitude gupta ]