my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Are these correct forms of inner class?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Are these correct forms of inner class??" Watch "Are these correct forms of inner class??" New topic
Author

Are these correct forms of inner class??

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Are following correct forms of inner class:
A. private final abstract class in
B. new innerclass() implements someinterface
Marcela Blei
Ranch Hand

Joined: Jun 28, 2000
Posts: 477
NO.
>A. private final abstract class in
You can�t use abstract and final modifiers at the same time. Think about the concept of each one. But you may use the private modifier for an inner class and you can declare an inner class to be abstract or final.
>B. new innerclass() implements someinterface
This one is supose to be an anonymous inner class? When you declare this kind on inner classes you can�t use the extends or implements keywords and you have to implement the class.
eg.

where the: new SomeInterface() {
(look at the open braces) means: implements SomeInterface with the following code.
I don�t know if that was clear, try reading a bit about anonymous inner classes.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Are these correct forms of inner class??