• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular Inner classes

 
thejaka samarakoon
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Regular Inner classes either has to be abstract or final(Do we have to define it in the code ?)can you give me a example.


 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thejaka samarakoon wrote:
Regular Inner classes either has to be abstract or final....


Where did you get this? It's wrong. The keyword abstract and final shouldn't be used together.
 
thejaka samarakoon
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:
thejaka samarakoon wrote:
Regular Inner classes either has to be abstract or final....


Where did you get this? It's wrong. The keyword abstract and final shouldn't be used together.


I want to know that regular inner classes must have a modifier using either abstract or either final not both.
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read the Inner classes chapter from K & B once again
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Putting abstract or final is not impotant, if you need them you can use one of them for a class. And, it behaves like the top level class in th context of extending, and overiding those classes and methods respectively.
 
Unmesh Chowdhury
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most basic characteristic of a non-static inner class is that, an instance of an inner class must be tied up with an instance of an outer class. Thus, we can think the regular inner class is an instance member of the outer class. Another basic characteristic of regular inner class is that, it cannot have any static context. Whether you will specify the regular inner class as abstract or final (but not both) is totally depended on your requirements. The following is a very basic example of regular inner class:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic