Open SHAMSRIZWAN opened 3 years ago
Generics in Java:
Generics in Java provide a way to create classes, interfaces, and methods that operate on objects of specified types. They allow you to parameterize the types used in your code. For example, List
Inheritance in Java: Inheritance is a fundamental concept in object-oriented programming where a class can inherit fields and methods from another class. In Java, every class (except for Object) has exactly one direct superclass (single inheritance).
Now, let's address the statement you provided: "It should be noted that standard class hierarchy does not apply to generic types." This statement might refer to the fact that when you have a generic type, such as List
For example, List
So, when you see List
Here's a simple example to illustrate this:
List
Integer value = integerList.get(0); // value is of type Integer, which inherits from Number
Hi, its written ,-> It should be noted that standard class hierarchy does not apply to generic types. It means that Integer in List is not inherited from - it is actually inherited directly from
but when see the class hierarchy it clearly extending The Number class can you eloborate on this , And thanks for collecting all the resources ,