Why does every object in Java implicitly extend java.lang.Object class?

前端 未结 10 2602
青春惊慌失措
青春惊慌失措 2020-11-29 04:21

I have been programming in Java for quite some time, but when I tried to explain what an java.lang.Object class is to a friend, I could not come up with more th

10条回答
  •  醉酒成梦
    2020-11-29 05:16

    This is done so as most of the basic functions like toString() etc would be automatically inherited and to your next question this is NOT multiple inheritence it is multilevel inheritence... In multiple inheritence single class is derived from 2 or more base class whereas in multilevel as you have said it has a base class which is itself derived from Object class

提交回复
热议问题