File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Inner Class
 
Similar Threads
inner class
inner class
How to use Abstract inner classes ?
Innner Class
Inner class