strange error ... Xlint

While playing around with HashSet and some words I'm learning in Chinese I got a strange error, or warning ...

Note: SortStuff.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

Do i need to use a try/catch block or somthing? Does anyone know what causes this?

Here is the code....

import java.util.HashSet;

import java.util.Iterator;

publicclass SortStuff{

static String[] lesson1Words ={"me","you","he","we","yous","they","which","country","person","people","America",

"Germany","German","China","Chinese","respected","surnamed","named","this","be",

"no","not","correct","company","Mr","good","goodbye"};

publicstaticvoid main(String args[]){

System.out.println("Start of Program....");

HashSet lesson1Set =new HashSet();

addToHashSet(lesson1Words,lesson1Set);

}

publicstaticvoid addToHashSet(String[] lessonWords, HashSet lessonSet){

for (int i=0;i<lessonWords.length;i++){

lessonSet.add(lessonWords[i]);

}

}

}

D:)>

[2536 byte] By [Deepoda] at [2007-11-26 18:07:42]
# 1

That is just a warning about the use (or lack of) Generics. You can choose to ignore it and your code will still execute. Or fix it like this:

HashSet<String> lesson1Set = new HashSet<String>();

This lets the compiler know that the only objects allowed in the HashSet are Strings.

floundera at 2007-7-9 5:39:09 > top of Java-index,Java Essentials,New To Java...