If I am in here for the second time within a few hours, should I delete my previous entry so that I don't swamp your friends page?
In a class called Menu, I have this code:
public static int selection(byte selection) throws IOException
{
}
This code is called in my main method. Within the main method, at the beginning, I have set index to zero. I was hoping that by calling Menu.selection(selection) where selection is equal to 1, I would have returned the value of index as 3. But if, after calling Menu.selection(selection) in the main, I print out the value of index... it is zero.
Any idea?
In a class called Menu, I have this code:
public static int selection(byte selection) throws IOException
{
int index = 0;
if(selection == 1)
{
System.out.println("You chose 1");
index = 3;
}
else if(selection == 2)
{
System.out.println("You've selected #2");
}
else if(selection == 3)
{
System.out.println("You've selected #3");
}
else if(selection == 4)
{
System.out.println("You've selected #4");
}
else if(selection == 0)
{
System.exit(0);
}
else
{
System.out.println("I'm sorry, you haven't entered a valid option. Please try again.");
display();
}
return index;}
This code is called in my main method. Within the main method, at the beginning, I have set index to zero. I was hoping that by calling Menu.selection(selection) where selection is equal to 1, I would have returned the value of index as 3. But if, after calling Menu.selection(selection) in the main, I print out the value of index... it is zero.
Any idea?
