File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Xlint:unchecked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply locked New topic


ahsan mir
Ranch Hand

Joined: Jul 17, 2006
Posts: 42
when i try to compile the following code as part of a servlet application , the following Xlint:unchecked error occurs.I cant understand since I am using jdk1.5 or is it referring to generics in collections?if so could anyone pls reply how to fix it(inc any code help).Thanks in advance.

import java.util.*;

public class BeerExpert{
public List getBrands(String color) {
List brands = new ArrayList();

brands.add("Jack Amber");
brands.add("Red Moose");
brands.add("Jail Pale Aile");
return (brands);


Note: uses unchecked or unsafe operations.
Note :Recompile with -Xlint:unchecked for details
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

If you're studying for SCWCD, you'd better use sdk1.4 instead.
That would spare you some time resolving that kind of problems.

[My Blog]
All roads lead to JavaRanch
marc weber

Joined: Aug 31, 2004
Posts: 11343

This is a cross-post. Please continue this discussion in the Java in General (beginner) forum.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: Xlint:unchecked
It's not a secret anymore!