How do I use the Concrete class? String Dog = new String;?
Do you mean "how do I use the Concrete method
ConcreteMethod() in
Myclass?"
If so, the answer is that since you provided a body for the method in your Abstract class, the method is inherited in any subclass, just as if you had provided the same implementation in your subclass. So, along with the code in the other replies, now you could say:
mc.ConcreteMethod() ; That would call the
ConcreteMethod() of mc (which is an object of type
MyClass).
Note, however, that to do anything useful with the String defined in
ConcreteMethod(), you need to change the definition as follows (changes are in
red):
public String ConcreteMethod()
{
String strName = "Jo Eagle" ;
return strName ;
} Now, you can actually store the String returned by the method in a new String, like so:
String cmstr = mc.ConcreteMethod() ; I hope all this helps. Please post any other questions this post may have raised (or in general that you may have).
------------------
- Ryan Burgdorfer
- Java Acolyte in
- Columbus, OH USA