Übung Testate

master
3009594 2024-12-03 11:41:32 +01:00
parent 1094628075
commit d7836fd17c
3 changed files with 13 additions and 6 deletions

View File

@ -0,0 +1,5 @@
package oop.record;
public class Person {
String name;
}

View File

@ -15,15 +15,14 @@ package oop.record;
* *
*/ */
public record Point(int x, int y) { public record Point(int x, int y, Person p) {
// Kein weiterer Code erforderlich, alle notwendigen Methoden und Felder // Kein weiterer Code erforderlich, alle notwendigen Methoden und Felder
// werden automatisch generiert. // werden automatisch generiert.
static int f = 10;
static int f = 10;
public static void main(String[] args) { public static void main(String[] args) {
Point p = new Point(1,2); Point p = new Point(1,2,new Person());
System.out.println(p.toString()); System.out.println(p.toString());
System.out.println(p.f); System.out.println(p.f);
System.out.println(p.x()); System.out.println(p.x());

View File

@ -13,8 +13,11 @@ public class Main {
arr.add(4); arr.add(4);
arr.add(19); arr.add(19);
arr.stream()
.forEach(i -> {System.out.println(Collectors.groupingBy(i2 -> i2).toString());
});
} }
} }