Hi
Please look at the following code
class Zoo {
public
String coolMethod() {
return "Wow baby";
}
}
class Moo extends Zoo {
public void useMyCoolMethod() {
// Does an instance of Moo inherit the coolMethod()?
System.out.println("Moo says, " + this.coolMethod());
// The preceding line works because Moo can inherit the
// public method
// Can an instance of Moo invoke coolMethod() on an
// instance of Zoo?
Zoo z = new Zoo();
System.out.println("Zoo says, " + z.coolMethod());
// coolMethod() is public, so Moo can invoke it on a Zoo
//reference
}
}
Can i declare
Moo m = new Moo();
m.coolMethod();
Is it works??
Then waht is the differnce between With and with out ectending???