• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

benefits of extending the Object class loudly

 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw a piece of code that goes like
public class SomeClass extends Object implements java.io.Serializable
Are there some benefits to explicitly state "extends Object" that I might overlook?
[ January 05, 2003: Message edited by: Mapraputa Is ]
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was it in a textbook? Some texts just do that to reinforce the concept that all classes ultimately inherit from Object. It seems to me that Bill Brogden put a statement in ExamPrep Java 2 why he did that, but I can't find it now that I'm looking for it.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also many IDEs have class wizards that will automatically generate this sort of crap for you. I think it's really only useful for making the situation more obvious to people who barely understand Java (who nonetheless may be expected to maintain your code because a company is too cheap to emply real programmers :roll: ).
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Almost textbook, it's a book for beginners. I thought that such extending would only confuse the reader, since this is never done anywhere else[corrected after reading Jim's comment. Ha, so maybe this sort of crap will help to understand IDE-generated code? ] and that all classes extend Object by default isn't such a difficult idea to grasp...
[ January 05, 2003: Message edited by: Mapraputa Is ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic