[Logo]
Forums Register Login
Compile Xlint Errors
Hi Guys,

I am in the process of following a tutorial from the head first JSP & servlets book and i have got stuck. Hopefully someone will be able to help me.

I have copied this code from the book


When i come to compile the code i get this message in the terminal


After i recompile with -Xlint i get these messages


Does anyone have any idea where i am going wrong?

Thanks,
-Ben
They aren't errors but warnings.

If you read this part of the Java Tutorial I'm sure you'll get a better understanding.
Hi Ben,

replace

public List getBrands(String color) {

with

public List<String> getBrands(String color) {

and

List brands = new ArrayList();

with

List<String> brands = new ArrayList<String>();

and your warnings will vanish. The problem has to do with generics, which are introduced
since Java Version 1.5

Kind regards
Thank you worked like a charm.

-Ben

This thread has been viewed 1052 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 15, 2018 20:25:05.