[Logo]
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.

Thanks
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 ]
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 18, 2017 11:12:58.