• Post Reply Bookmark Topic Watch Topic
  • New Topic

final class  RSS feed

 
henry leu
Greenhorn
Posts: 17
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that a final class contains all the final methods. What about its instance variables? Are instance variables also final?
 
Stefan Evans
Bartender
Posts: 1837
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A final class cannot be extended.
A final method cannot be overridden by a subclass
A final instance variable can not have its value changed after the initial assignment.

Does it make sense for a final class to have a non-final method? Can they ever be overridden?
Does it make sense for a final class to have a non-final instance variable? Can they ever have their value changed?


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!