What is wrong? First it wouldn't compile until I changed the import line for import java.util.*; and now I need to declare a hashSet variable that it is there...
package com.codegym.task.task08.task0801;
/*
HashSet of plants
*/
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Set<String> set = new HashSet<String>();
set.add("watermelon");
set.add("banana");
set.add("cherry");
set.add("pear");
set.add("cantaloupe");
set.add("blackberry");
set.add("ginseng");
set.add("strawberry");
set.add("iris");
set.add("potato");
for(String text : set) {
System.out.println(text);
}
}
}