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.
- Host: GitHub
- URL: https://github.com/24luca24/java-generics-wildcards-inheritance-example
- Owner: 24luca24
- License: mit
- Created: 2025-01-16T14:38:37.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-16T14:56:04.000Z (3 months ago)
- Last Synced: 2025-01-16T16:19:17.296Z (3 months ago)
- Language: Java
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 valuesTo read better the Shape class that is the one with the examples, I sugget the use of "Better comments" extention on VSCode.