把实验七实验报告里的代码拷进来了

This commit is contained in:
2024-06-10 18:38:44 +08:00
parent ffcafcadea
commit 2c7ad64d2f
5 changed files with 58 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
package task3;
import java.util.HashSet;
import java.util.Scanner;
public class HelloSet {
public static void main(String[] args) {
HashSet<Object> hashSet = new HashSet<>();
Scanner scanner = new Scanner(System.in);
for (int i = 0; i < 5; i++) {
hashSet.add(scanner.next());
}
// ---------------------Begin------------------------
// ---------------------End------------------------
hashSet.forEach(ele -> System.out.println(ele));
}
}