hi, i'm working on a little project i made for myself, i want to create a menu with 4 choices and i want to use an array cause im struggling to understand how write them, now ive started to do it but i've lost myself in the code and don't know what to do let me know what you think!

import javax.swing.*;
public class food
{
private int idnum;
{
int order;
int[] idnum = {1, 2, 3, 4}
menu = JOptionPane.showInputDialog(null, "The menu today is 1 chicken 2 pizza 3 chocolate and 4 water");
order = Integer.parseInt(menu);
if(order == idnum)
JOptionPane.showMessageDialog(null, "You have ordered

i want to be able to lets say if someone enters 1 for chicken how do i tell the program that the person ordered menu item 2 and have the program figure out that item number 2 is chicken or something i'm confused!

you're making quite some errors against java syntaxis.

don't put too many brackets, and don't forget to close your statements with ';'

Hey Its Better u check ur code again with the help of an IDE if u r not sure of the syntaxes as there are many syntax errors i ur programme.... Get rid of the syntax and better post it again...... And u dont write everything in the class.... See to that too.... U need some methods over there

Hey Its Better u check ur code again with the help of an IDE if u r not sure of the syntaxes

the best would be to study the syntaxis and not solely relying on an IDE to guide you through the process. Granted, an IDE can come in handy and will save you some time if you know what to do in the first place, but it 'll prevent you from learning the syntax if you start relying on it at day one

you may want to consider the old saying (it's about dictionaries, but it can be applied to IDE's as well :) )

Dictionaries are like watches, the worst is better than none, and the best cannot be expected to go quite true.

the best would be to study the syntaxis and not solely relying on an IDE to guide you through the process. Granted, an IDE can come in handy and will save you some time if you know what to do in the first place, but it 'll prevent you from learning the syntax if you start relying on it at day one

you may want to consider the old saying (it's about dictionaries, but it can be applied to IDE's as well :) )

Dictionaries are like watches, the worst is better than none, and the best cannot be expected to go quite true.

Agree with u on that but what i wanted to say is that a way fro him to get an idea of the syntaxes andf of course I agree that it is not the best way..... And also not a good practice for beginners

This article has been dead for over six months. Start a new discussion instead.