wood burning stoves 2.0*
The moose likes Servlets and the fly likes Question on HF Servlets & JSP 2nd - The beer expert under Java 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Question on HF Servlets & JSP 2nd - The beer expert under Java 5" Watch "Question on HF Servlets & JSP 2nd - The beer expert under Java 5" New topic
Author

Question on HF Servlets & JSP 2nd - The beer expert under Java 5

Ellery
Greenhorn

Joined: Dec 15, 2008
Posts: 2
Dear all

I am now reading the book of HF Servlet & JSP 2nd and found the following code:



And the BeerExpert class:



Well, the question is that, BeerSelect.java cannot be compiled with the following well-know warning:



Actually I know that, when I use the @SuppressWarnings("unchecked") statement above the "List<String> result = be.getBrands(c);", the code can be compiled nicely. However, I don't want to avoid that everytime when I meet this error. But the question is : how can I change to have it compiled?

Can anyone please help me to solve this problem?

Thank you very much in advance for all your help.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3816

Your getBrands method in BeerExpert class may return a List of Strings. That will solve the problem (actually that's a warning not a compiler error), though you may be able to run the code without it



SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Ellery
Greenhorn

Joined: Dec 15, 2008
Posts: 2
Thank you very much, it works now!

Javaranch is really a nice place
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

"alucard", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Question on HF Servlets & JSP 2nd - The beer expert under Java 5
 
Similar Threads
Problem in accessing model in diffeerent package(Servlet-HFS)
Compilation Problem in CHAP3 example
package help
beerExpert.java uses unchecked or unsafe operations
package does not exist problem