This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes abstract classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "abstract classes" Watch "abstract classes" New topic
Author

abstract classes

sreedhara satuluri
Greenhorn

Joined: Mar 17, 2005
Posts: 12
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 ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract classes
 
Similar Threads
passing variable in to method...
Garbage Collection and Post Increment Operator doubts
Please suggest me why im getting sysouts of super class
Abstract Class
whats wrong with my code ?