Hello,

I'm taking a intro course in Java and I'm having a bit of trouble. The course I'm taking doesn't allow me to ask questions of the instructor so I've got to turn to online resources for help. The course I'm taking was written in 2017 and I now the language has changed a little since then. I'm getting an error message that says "identifier expected." It has underlined the "try" and "catch" block as the problem. Here is my code:

import java.security.KeyStore.TrustedCertificateEntry;
import java.util.HashSet;
import java.util.Set;
import java.util.Spliterator.OfPrimitive;
import java.util.TreeSet;


public class Main {

public static void main(String[] args) {
}

int count[] = {3,4,6,9,10,23};
//Treeset
Set<Integer> set = new HashSet() {
}
try
{
for (int i = 0; i < count.length; i++);
set.add(count[i]);


TreeSet sortedSet = new TreeSet(set);

System.out.println("Sorted List: " + sortedSet);
}
catch (Exception e){} {

}

}

What am I doing wrong here?

Thanks in advance.


Joel W