• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner Class

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1
Can i add abstract inner class ?
i'm not sure Is it valid decleartion in the INNER Classes,
abstract class XXXX
Q2
can i add arguments to the Anonymous Class
for example : new MyClass(x){
//some code
}
 
Vasanth Appaji
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can add abstract inner classes.
Anonymous classes are those that do not have any names and are directly instantiated when created. So, the name that comes after the new operator is the class that the anonymous class extends or the interface that it implements(only one at a time). So, you can add arguments to the anonymous class, provided that the the class you are extending has that constructor. Obviously, with anonymous classes implementing interfaces, you cannot do this.
Please correct me if I'm wrong.
--Vasanth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic