abstract static class Myabs
{
abstract void print();
}
public class abdemo extends Myabs
{
void print()
{
System.out.println("hello");
}
public static void main(
String[] args)
{
abdemo a = new abdemo();
a.print();
}
}
output :
Exception in
thread "main" java.lang.Error: Unresolved compilation problem:
Illegal modifier for the class Myabs; only public, abstract & final are permitted
at Myabs.<init>(abdemo.java:2)
at abdemo.<init>(abdemo.java:8)
at abdemo.main(abdemo.java:18)
Also, we can't used both final and abstract together.
Please anyone why can't we use static with abstract.