0

Everyone know about every Class in java should be extends from Objects Class.

Let me explain with example there are two classes A and B.

Class A extends B {
}

Note: Every Class should inherited from Object class by default. So we can say class A extends from two Classes One is 'Class B' and Second is 'Class Object'.

I am confused about Object class extends of every class.

Z.I.J
  • 1,157
  • 16
  • 36
  • Nope. Class `A` extends class `B`, which might extend `Object`. – Mena Nov 20 '15 at 11:07
  • 2
    @Mena not **might**, but **does** –  Nov 20 '15 at 11:09
  • @Paul you don't know that, as class `B`'s source isn't in the question. – Mena Nov 20 '15 at 11:09
  • @Mena **every** class is an (probably) indirect subclass of `Object`. A class that doesn't extend from any other class **always** implicitly extends `Object`. –  Nov 20 '15 at 11:11
  • @AndyTurner duh. That doesn't mean class `B` is not extending another class. It's not in the question. Of course the top class is always `Object`. But when you say "something extends something else", the tacit agreement is you're talking about direct inheritance. Class `B` is not shown in the question, so we don't know whether it extends class `C`, etc. or "nothing", i.e. implicitly `Object`. – Mena Nov 20 '15 at 11:12
  • I have agreed with @Mena comments. But I am still confused. – Z.I.J Nov 20 '15 at 11:13

0 Answers0