• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

cana class extend a class which is jar and added to a classpath

I have to extend a class which is in different package or which is in server.jar. Is that possible?
I am using eclipse, it does say its not finding parent class.
0
cutie_smily
Asked:
cutie_smily
  • 2
  • 2
  • 2
  • +1
4 Solutions
 
CEHJCommented:
It can extend any class that's loadable. To be loadable it must be on your classpath so add the jar to your Build Path (Add jars)
0
 
ksivananthCommented:
as long as you have added server.jar in the Libraries list and the class has the right access( public ), you can
0
 
cutie_smilyAuthor Commented:
Thanks everybody
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
cutie_smilyAuthor Commented:
Base class Animal
sub class cow

Animal a=new cow();
a.speak(); //it says Animal does not have speak method.

Doesn't it get from subclass ?
0
 
CEHJCommented:
Animal should have it as a method (abstract)
0
 
objectsCommented:
Its only possible if the class is not final. If the class is not declared as final then you aref ree to subclass it

> Base class Animal
> sub class cow
> Animal a=new cow();
> a.speak(); //it says Animal does not have speak method.

> Doesn't it get from subclass ?


Need to either use:

cow a = new cow();

or cast it:

((cow)a).speak();

or add a speak() method to the Animal class

0
 
ksivananthCommented:
>>Doesn't it get from subclass ?

If the method exist only in the subclass, there is no way the Animal class can point to that method which it not aware of, try object's comment.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now