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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Correct Inner Class...." Watch "Correct Inner Class...." New topic
Author

Correct Inner Class....

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What might form part of correct inner class declaration and installation?
A. new simpleInterface(){}
B. new complexInterface(x) {}
C. private final abstract class c
D. MyClass extends OtherClass
E. new MyClass() extends OtherClass{}
The answer is A,B,
Can anybody explain why E is not an answer?
Thanx
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
i think e is also the correct answer. inner class has the freedom
of extending any class.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Tian,
This question is about the construct of anonymous classes.
For defining and instantiating an anonymous class, use the following syntax:
new superclassName ( optional arg list ){ ...... }
NO extends clause is used in the construct!

Hopes this help!
Erin
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks, I got it.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
new MyClass() extends OtherClass{} is not correct because
new MyClass() is not a class it is merely an object of MyClass. And an object cannot extend a class
Mohit pundir
Greenhorn

Joined: Jun 30, 2007
Posts: 5
Originally posted by Tian:
What might form part of correct inner class declaration and installation?
A. new simpleInterface(){}
B. new complexInterface(x) {}
C. private final abstract class c
D. MyClass extends OtherClass
E. new MyClass() extends OtherClass{}
The answer is A,B,
Can anybody explain why E is not an answer?
Thanx


I got confused about option B ,
Can we have constructors for Interface.
or
B. new complexInterface(x) {}
Exan any one explain me how this works?
Thanx
Mohit
 
Consider Paul's rocket mass heater.
 
subject: Correct Inner Class....