Multiple choice technology programming languages

Which statements are true?

  1. Inheritance defines a has-a relationship between a superclass and its subclasses

  2. Every Java object has a public method named equals

  3. A class can extend any number of other classes

  4. A non-final class can be extended by any number of classes

Reveal answer Fill a bubble to check yourself
B,D Correct answer
Explanation

Option B is correct - every Java object inherits the equals() method from Object class. Option D is correct - a non-final class can be extended by unlimited subclasses. Option A is wrong - inheritance defines an 'is-a' relationship, not 'has-a'. Option C is wrong - Java supports only single inheritance, not multiple classes.