Hi -
There are several problems with the code...
... including the fact that you're not initializing testNumber
... which will cause all values you insert to compare as "=="
... which won't work with a "Set" (where all values must be unique...)
But the real problem is shown in this traceback (which you probably should have cut/pasted along with the code):
C:\temp>java test
Exception in thread "main" java.lang.ClassCastException: test cannot be cast to
java.lang.Comparable
at java.util.TreeMap.put(Unknown Source)
at java.util.TreeSet.add(Unknown Source)
at test.main(test.java:10)
The solution is here:
http://blog.tmro.net/2007/08/silly-classcastexception-in-java.html