Originally posted by Gong James:
when I comile the code the following is print out.
But ........
//---------compile error------------//
Test1.java:6: ������������
���������� speak ()
�������� in java.lang.Objec
bb.speak();
^
1 ������
//------------end-----------------//
Can you give me a explain about the above.
Hi Gong
when I compile, got this error:
//---------compile error------------//
D:\JavaTp\Test011114.java:6: Method speak() not found in class java.lang.Object.
bb.speak();
^
1 error
//------------end-----------------//
I think now u must have got what is the error you are getting.
and methods are checked by the object reference variable(at compile time). That's why for overriding method should have same signature and return type.
at the runtime method is invoked of the object whom that ref variable is pointing.
HTH
CMIW
------------------
Regards
Ravish
[This message has been edited by ravish kumar (edited November 14, 2001).]