An open API service indexing awesome lists of open source software.

https://github.com/24luca24/java-generics-wildcards-inheritance-example

An educational Java project demonstrating the use of generics, wildcards, inheritance, and polymorphism in object-oriented programming. The project explores type safety, upper and lower bounded wildcards.
https://github.com/24luca24/java-generics-wildcards-inheritance-example

Last synced: 2 months ago
JSON representation

An educational Java project demonstrating the use of generics, wildcards, inheritance, and polymorphism in object-oriented programming. The project explores type safety, upper and lower bounded wildcards.

Awesome Lists containing this project

README

        

# Java-Generics-Wildcards-Inheritance-Example
As a student I need to do an exame for the subject Advance Java Programming.
A small piece of the program cover generics, wildcards, inheritance, and polymorphism in object-oriented programming.
To get more in confidence with the concepts and with the kind of exercises in the exams I decided to do a small repository, where I can practice the topic.
In particular I've create a hierarchy and I resolve this exercise:

- Consider only the ArrayList implementation for the List interface. For each of the following variables (List (of Shape) list, List extends Ellipse> list, List super Triangle> list), write:
1. all (possibly raw) types of ArrayList instances that can be assign to the variable
2. all (possibly raw) types that can be obtained from a get operation on list;
3. all (possibly raw) types that can be added to the list with an add operation. Consider null values

To read better the Shape class that is the one with the examples, I sugget the use of "Better comments" extention on VSCode.