"SCJP5 | SCWCD5| DEVELOPER"
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Regards,<br />Pradeep Balasubramanian<br /> <br />You have to grow from the inside out. None can teach you, none can make you spiritual. There is no other teacher but your own soul. <br /> <br />- Swami Vivekananda
Originally posted by sri dev:
class Foo
{
public void doFooStuff()
{
System.out.println("All Foo stuff");
}
}
class Bar extends Foo
{
public void doBarStuff()
{
System.out.println("All Bar Stuff Baby!");
}
}
class TestFooBar
{
public static void main(String[] args)
{
Foo f=new Bar(); //legal as bar is the subclass of foo
f.doBarStuff();
}
}
The above Foo and Bar classes have compiled but the "TestFooBar" class is not compiling and showing the following error , what can be the error?
TestFooBar.java:8: cannot find
symbol : method doBarStuff()
location: class Foo
f.doBarStuff();
^
1 error
Thanks and Regards,
Chinmay
"SCJP5 | SCWCD5| DEVELOPER"
Regards
vinod SCJP 6.0
"SCJP5 | SCWCD5| DEVELOPER"
Sun Certified Java Programmer<br />Sun Certified Mobile Application Developer
Regards
vinod SCJP 6.0
Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer