When I compile my java source code it shows me a note: Recompile with -xlint:unchecked for details. Can any one explain me why it is showing such a note?
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Can any one explain me why it is showing such a note?
No, not unless we had the code you are compiling and your compile environment.
In order to tell, we would have to run your compile and add the -xlint:unchecked option when compiling. Then we could look at what the compiler messages were and tell you.
Can any one explain me why it is showing such a note?
No, not unless we had the code you are compiling and your compile environment.
In order to tell, we would have to run your compile and add the
-xlint:uncheckedoption when compiling. Then we could look at what the compiler messages were and tell you.It would be a lot easier if you did it, though.
Tom
This is my code and my compile environment is JDK7import java.util.*;
public class CIDemo{
public static void main(String[] args){
List ls = new ArrayList();
ls.add(“ABC”);
ls.add(“xyz”);
ls.add(“abc”);
System.out.println(“Elements of array list \n”);
Iterator itr = ls.iterator();
while(itr.hasNext()){
Object ele = itr.next();
System.out.println(ele);
}
}//End of main
}//End of Collection interface
What happened when you recompiled with -Xlint:unchecked specified? (If you won’t try it, why should we?) — Tom
Finaly got it by just adding String after List and here is the code:import java.util.*;
public class CIDemo{
public static void main(String[] args){
List<String> ls = new ArrayList<String>();
ls.add(“ABC”);
ls.add(“xyz”);
ls.add(“abc”);
System.out.println(“Elements of array list \n”);
Iterator itr = ls.iterator();
while(itr.hasNext()){
Object ele = itr.next();
System.out.println(ele);
}
}//End of main
}//End of Collection interface