This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes What's wrong with this code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What Watch "What New topic

What's wrong with this code?

Chaturaka Gunatilaka

Joined: Oct 06, 2012
Posts: 16

This code is not excuting.Why?Thanks.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I can compile and run it fine. What do you think is wrong with it? In other words, what were you expecting it to do differently?
Chaturaka Gunatilaka

Joined: Oct 06, 2012
Posts: 16

when I try to compile this I got the above message.
Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

What's wrong with this code?


Besides, when you compile the code with:

you'll get details about why the compiler complains. And after you see that message, you can refer back to this topic where someone else has provided a solution for the same issue.

The quieter you are, the more you are able to hear.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
Please use copy‑and‑paste for such messages.
Try javac -Xlint:unchecked and compile it again. You can find out about the lint tool here and here.
That particular warning (not error) probably means that you are using a parametrised type (probably the Combo Box) without giving it an actual type parameter. If you add an actual type parameter to the combo box declaration and don’t use a raw type, you can be sure it will work.
Another way to put it: you ought to use generics somewhere and you didn’t. If you find old versions of the combo box API you can see that only the most recent versions of combo box actually had a formal type parameter. You can read about generics in the Java Tutorials.
I agree. Here's the link:
subject: What's wrong with this code?
jQuery in Action, 3rd edition