• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compile Xlint Errors

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They aren't errors but warnings.

If you read this part of the Java Tutorial I'm sure you'll get a better understanding.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
B Crosthwaite
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you worked like a charm.

-Ben
 
reply
    Bookmark Topic Watch Topic
  • New Topic