• 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

abstract classes

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is seen and read in theory that abstract class cannot be instantiated but there is a program in which an abstract class is instantiated.



please comment on this

[ EJFH: Added "CODE" tags. ]
[ March 17, 2005: Message edited by: Ernest Friedman-Hill ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're not instantiating abstclass1 and abstclass2; you're instantiating anonymous inner classes that extend abstclass1 and abstclass2 and provide the missing methods. An anonymous class is a real class, and the compiler generates a .class file for it (in this case, likely called
AbstractClass_Ex3$1.class and AbstractClass_Ex3$2.class .) They just don't appear to have a name at the point of declaration. These anonymous classes are every bit as real as abstclass3 and abstclass4.

Note: when you post code, please use the UBB "code" tags. Below the text area where you type your message, there are a bunch of little buttons; one says "CODE". Use that one, and your code will appear formatted in your post.
reply
    Bookmark Topic Watch Topic
  • New Topic