Originally posted by rajesh baba:
import java.util.*;
class animal
{
animal()
{
System.out.println("i am called");
}
}
class alist
{
// remaining code
}
output:
C:\jdk1.5.0_11\bin\coll>javac alist.java
Note: alist.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
what the note mean by i don't understand can any body explain
The 'Note' is warning and telling you that this class uses unsafe operations.
Java 1.5 has implemented Type safe collections. With this you can specify what kind of data would be collected in List. Eg: You can declare ArrayList to store all String data.
List<String> mylist = new ArrayList<String>();
You can add String objects only to this list. If you try to insert other datatype then compiler will throw error.
Here in your example, the class is using old list type, which is not type safe. So you can add any object to that list. As you are compiling this with java 1.5 its warning you that collection is not typesafe.
Second note is telling you that , recompile this class with -Xlint:unchecked for details.
If you recompile with that it will show you where exactly you are trying to add wrong data. But in your case it will not show that b'coz you are not using typesafe collection .
Hope this helps.