I have written code as follows
abstract class Test
{
void a()
{
System.out.println("in abstract class");
}
}
class Test1 extends Test
{
void a()
{
System.out.println("in main class");
}
public static void main(String args[])
{
System.out.println("in main method");
a();
}
}
This is showing compile time error that non-static method a() cannot be referenced from a ststic context.
After that i wrote this
abstract class Test
{
static void a()
{
System.out.println("in abstract class");
}
}
class Test1 extends Test
{
static void a()
{
System.out.println("in main class");
}
public static void main(String args[])
{
System.out.println("in main method");
a();
}
}
then this is running fine.But i dont want to make that method static.Is there any other solution for that?