aspose file tools*
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
Author

Xlint:unchecked

ahsan mir
Ranch Hand

Joined: Jul 17, 2006
Posts: 42
Hello,
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();
if(color.equals("amber"))

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

}

**************************************************************************
C:\javac BeerExpert.java
Note: BeerExpert.java uses unchecked or unsafe operations.
Note :Recompile with -Xlint:unchecked for details
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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
Sheriff

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
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Xlint:unchecked