• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object class

 
Mahesh Bamane
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why Object class in not declared as an abstract in Java API, this is just out of interest. I've read few blogs on this but couldn't get much satisfied answer. So just thought of posting here.
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So that all things Java will have a concrete foundation? (cheesy)

Interesting question, never really thought to ask this before but I suppose it's not declared abstract because it has no abstract methods. I would think others elsewhere would have been given this answer. If so, why do you not find that satisfactory? If not, well, huh ... seems pretty straightforward.
 
Henry Wong
author
Marshal
Pie
Posts: 21021
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahesh Bamane wrote:Why Object class in not declared as an abstract in Java API, this is just out of interest. I've read few blogs on this but couldn't get much satisfied answer. So just thought of posting here.


The problem with "WHY" questions, especially when related to classes since Java 1.0, is that you need to have one of the original Java designers to answer it. Any other answer (from someone else) would be speculating.

Personally, I don't know. But I can speculate why it hasn't been made abstract since (meaning "after") Java 1.0. My speculation is that it is possible to use an Object instance as a synchronization lock, and if they made it abstract after Java 1.0, it would have broken backward compatibility.

Henry
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:you need to have one of the original Java designers to answer it. Any other answer (from someone else) would be speculating.

Or maybe just someone who tries to find the simplest, most logical answer possible (running and ducking)
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from java.util.HashSet


i would have annoyed, for simple class creation required overriding. and as Junilu pointed out abstract class with out abstract methods are meaningless.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic