What does the following code output?
```java
public class A {}
public class B extends A {}
public class C extends B {}
public class D extends C {}
public class E extends C {}
```
This code defines a class hierarchy where B extends A, C extends B, and D and E extend C. There is no output, as this code only defines classes.
Identify the error in the following code:
```java
public class Animal {}
public class Dog inherits Animal {}
```
The keyword 'inherits' is incorrect. It should be 'extends'.
What is the definition of Inheritance?
A mechanism where a subclass acquires properties and behaviors from a superclass.
What is the definition of a Subclass?
A class that inherits from another class (the superclass).
What is the definition of a Superclass?
A class from which other classes (subclasses) inherit.
What is the main purpose of inheritance?
To reuse code, establish an IS-A relationship, and organize classes hierarchically.
Why does Java only allow single inheritance?
To avoid the diamond problem, which occurs when a class inherits conflicting methods from multiple superclasses.
What does 'extends SuperClassName' do in Java?
It specifies that the class inherits from the specified superclass.
What is the IS-A relationship in inheritance?
It describes how a subclass is a more specific type of its superclass (e.g., APSubject IS-A SchoolSubject).