This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What Watch "What New topic
Author

What's wrong with this code?

Chaturaka Gunatilaka
Greenhorn

Joined: Oct 06, 2012
Posts: 16


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

Joined: Mar 22, 2005
Posts: 41155
    
  45
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?


Ping & DNS - my free Android networking tools app
Chaturaka Gunatilaka
Greenhorn

Joined: Oct 06, 2012
Posts: 16


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

Joined: Jun 19, 2010
Posts: 825
    
    5

What's wrong with this code?

Indentation.

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
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
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.
 
Don't get me started about those stupid light bulbs.
 
subject: What's wrong with this code?
 
Similar Threads
Accessing JFrame contents
searcheable jcombobox custom renderer
JComboBox Selection?
rendering a jcomboBox
JComboBox