diff --git a/de.hhn.ai.prog2.blatt6.collections/.vscode/launch.json b/de.hhn.ai.prog2.blatt6.collections/.vscode/launch.json index be6973c..b751769 100644 --- a/de.hhn.ai.prog2.blatt6.collections/.vscode/launch.json +++ b/de.hhn.ai.prog2.blatt6.collections/.vscode/launch.json @@ -4,6 +4,13 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "type": "java", + "name": "CodeLens (Launch) - GenericsAufgabe", + "request": "launch", + "mainClass": "app.GenericsAufgabe", + "projectName": "de.hhn.ai.prog2.blatt6.collections" + }, { "type": "java", "name": "Debug (Launch) - Current File", @@ -16,7 +23,7 @@ "request": "launch", "mainClass": "app.App", "projectName": "de.hhn.ai.prog2.blatt6.collections", - "console": "integratedTerminal", + "console": "integratedTerminal" } ] } \ No newline at end of file diff --git a/de.hhn.ai.prog2.blatt6.collections/src/app/GenericsAufgabe.java b/de.hhn.ai.prog2.blatt6.collections/src/app/GenericsAufgabe.java new file mode 100644 index 0000000..a847a03 --- /dev/null +++ b/de.hhn.ai.prog2.blatt6.collections/src/app/GenericsAufgabe.java @@ -0,0 +1,17 @@ +package app; + +public class GenericsAufgabe { + @SuppressWarnings("unused") + public static void main(String[] args) { + GenericsAufgabe g = new GenericsAufgabe(); + String s = g.spezialmethode("Hallo"); + float f = g.spezialmethode(2.3f); + char c = g.spezialmethode('a'); + + } + + private U spezialmethode(U generic) { + System.out.println(generic + " ist vom Typ " + generic.getClass()); + return generic; + } +} \ No newline at end of file