Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What's wrong with this code?

 
Chaturaka Gunatilaka
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This code is not excuting.Why?Thanks.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


when I try to compile this I got the above message.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic