File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

final

 
josephine chen
Ranch Hand
Posts: 216
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is from marcus exam 3 says true
when applied to a class , the final modifiers means it cannot be subclassed ?
i feel that it can be subclassed but cannot have subclasses
ie
final class X extends Y{}//ok
class z extends X//wrong
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
final class X extends Y{}//ok
class z extends X//wrong
you are right, cannot subclass final classes. In u'r case
Class x is final which is a subclass of class Y but cannot have any subclass of class X.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When Marcus says that a final class cannot be subclassed, that means that it cannot have any subclasses. It says nothing about whether the final class is already a subclass of some other class (which it must be, if only of Object). If he'd said that a final class cannot be a subclass, then the statement would be incorrect. But "cannot be subclassed" means "you cannot extend a subclass from this one," nothing else.
Shan (or anyone else who knows)- what is the URL for Marcus' exam 3, anyway? It seems to have moved from where it was a couple months ago.
 
josephine chen
Ranch Hand
Posts: 216
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I am not able to find the mock 3 exam site but
I have the print out .
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic