aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner Class" Watch "Inner Class" New topic
Author

Inner Class

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Aug 22, 2000
Posts: 13
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
 
wood burning stoves
 
subject: Inner Class