Add Java-Kompendium book

This commit is contained in:
2025-11-24 23:20:51 +01:00
parent f3b3d4b1a2
commit a680b83e47
8 changed files with 122 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import java.util.*;
public class Task3 {
public static void main(String[] args) {
var javaList = new HashSet<String>(3);
var pythonList = new HashSet<String>(3);
var commonList = new HashSet<String>();
var differenceSet = new HashSet<String>();
javaList.add("Maximilian Mayer");
javaList.add("Emil Faber");
javaList.add("Anna Müller");
pythonList.add("Anna Müller");
pythonList.add("Sebastian Waller");
pythonList.add("Oliver Stilz");
commonList.addAll(javaList);
commonList.addAll(pythonList);
differenceSet.addAll(javaList);
differenceSet.retainAll(pythonList);
System.out.println("Java-Kurs: " + javaList);
System.out.println("Python-Kurs: " + pythonList);
System.out.println("Alle Teilnehmer: " + commonList);
System.out.println("Beide Kurse: " + differenceSet);
}
}