For example:
javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This comes up in Java 5 and later if you’re using collections without type specifiers (e.g.,
Arraylist()instead ofArrayList<String>()). It means that the compiler can’t check that you’re using the collection in a type-safe way, using generics.To get rid of the warning, you need to be specific about what type of objects you’re storing in the collection. So, instead of
use
In Java 7 you can shorten generic instantiation by using Type Inference.