
import java .util.*; class ArrayListDemo { public static void main(String[] args) { ArrayList l=new ArrayList(); l.add("A"); l.add(10); l.add(null); System.out.println(l); l.remove(2); System.out.println(l); l.add(2,"M"); l.add("N"); System.out.println(l); } }
in the above java program compilation time following error is occur in my system
Note: ArrayListDemo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
so plz send me answer why this error is coming............ and what is the reason and solution ....

This comes up in Java 5 and later if you're using collections without type specifiers (e.g., Arraylist() instead of ArrayList<Object>()). It means that the compiler can't check that you're using the collection in a type-safe way, using generics.
To avoid this error, specify the type of object you're storing in the collection. So, specify the type as the following:
ArrayList<Object> l= new ArrayList<Object>();
In your code, you have added integer as well as string values to list therefore you need to use Object. Otherwise, whatever values you added, specify the type specifier.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.