Suhas is right. You can call abstract methods of an abstract class without problems. This is because you can only instantiate concrete classes, and concrete sub classes of abstract classes have implemented the abstract methods.
thats quiet hepfull, and bit confused also and actually I have a file names Hello.java which is a abstract class and I have a one method init and I have onemore class called use.java and both are in same packeage and I want to use method in Hello.java which is a abstract class in Use.java How can I do that?
Joined: Jul 20, 2009
Did you understand Rob's sample? If not, read it again. If you did, your problem should be solved. But to help us to help you, you should post your code here...
sorry for late reply I have been quite busy with some other work ,as you said about supplying classpath to the java compiler, here there is a makefile to compile all java programs at once and I am confused how to supply the classpath at compilation time
3) your only assignment to m_routePlan occurs on line 21: "m_routePlan = mv.routePlan();". mv's own copy of m_routePlan has never been assigned though, so it still returns null. mv gets created on line 20. Its constructor does not set its m_routePlan field so it stays null. You then ask for it on line 21, and since it's null your object's m_routePlan field is set to null as well.
The latter being the most important advice. The anti-pattern doesn't prevent your program from working, it's just bad style. And yes, Sun has used this bad style as well (in Swing among others. SwingConstants, sight...).
You mean I need to crate one constructor then I need to instantiate the routeplan in this constructor right
Joined: Dec 11, 2009
When you create a new object as
MovingObject mo = new Use();
constructor for Use() will be called which will in turn invoke the parent class constructor(MovingObject). Now MovingObject does not have a zero argument constructor. Also
Use does not have a constructor that calls super().
Could this be the problem? Experts please confirm.
I would *strongly* suggest starting a new thread, posting your complete code, and asking some very specific questions--this thread has gotten very difficult to follow, and I'm not even sure what problem you're having at this point.
Normally I wouldn't, but I'm going to lock this thread to make you start over. Before posting the new thread, I'd make sure your code is as clean as possible, formatted nicely, and so on. It'll also give you an opportunity to look over your existing code and figure out exactly what's wrong and what you need to ask. You may be able to answer your own question, too--sometimes taking a step back is very helpful.