Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

class

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is a class subclass of itself?
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not in Java.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The complete reference by Patrick Naughton says it is - ie. every class is a sub class of itself. Only a "strict" sub class of a class cannot include itself.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Different people in OOP have slightly different definitions of "subclass", but in this case the definition Naughton uses is not the one used in Java. The JLS has a precise definition of subclass which does not include the class itself - only other classes which are extended from it, and their "descendents". If you see the word "subclass" on the exam, you can assume this is the definition used.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jim Yingst:
Different people in OOP have slightly different definitions of "subclass", but in this case the definition Naughton uses is not the one used in Java. The JLS has a precise definition of subclass which does not include the class itself - only other classes which are extended from it, and their "descendents". If you see the word "subclass" on the exam, you can assume this is the definition used.


Thanks! All for replying.
 
reply
    Bookmark Topic Watch Topic
  • New Topic