jQuery in Action, 3rd edition
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 Building Microservices this week in the Design 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
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Inner Class
 
It's not a secret anymore!