Forums Register Login
abstract class problem
I have a problem with the following;I request you to go through the code

abstarct class X
abstract void a1();
abstract void a2(some parameter);

abstract class Y extends X
abstract void a1()
{ //some code;

some code... for a2() etc
public static void main(String args[])
How can I access a1() here??

I cannot create an object of Y here;
How can I access a1() inside class Y
note: I am not using any other class (like class C extends Y etc...)

any one please help me to sort out the above problem.

If you've implemented a1 and a2 in Y, why are you declaring it abstract ?

If it is abstract because there are other abstract methods declared in it, then you need to declare another (non-abstract) class that extends Y and implements all the methods. You can then create an instance of this class and call the a1 method.

If there is no reason to make Y abstract, then remove the abstract keyword and you will be able to create an instance of it.
[ August 18, 2006: Message edited by: Joanne Neal ]
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
Thread Boost - a very different sort of advertising

This thread has been viewed 408 times.

All times above are in ranch (not your local) time.
The current ranch time is
Apr 22, 2018 10:32:56.