1
0

Finish Java Kompendium book

This commit is contained in:
2025-12-07 12:22:07 +01:00
parent 5eded28b16
commit c95abc31d6
30 changed files with 1400 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
public interface BerechnenInterface {
int berechnen(int x, int y);
}

View File

@@ -0,0 +1,10 @@
public class Main {
private static void print(BerechnenInterface lambda) {
System.out.println(lambda.berechnen(2, 3));
}
public static void main(String[] arguments) {
print((a, b) -> a + b);
print((a, b) -> a * b);
}
}

View File

@@ -0,0 +1,20 @@
import java.util.HashSet;
import java.util.HashSet;
public class Task2 {
public static void main(String[] arguments) {
var set = new HashSet<Integer>();
set.add(1);
set.add(3);
set.add(5);
set.add(7);
set.add(9);
set.add(11);
set.add(15);
set.add(20);
set.add(21);
set.forEach(v -> System.out.println(v * 2));
}
}