• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question on abstract

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic