So, I want to parse several integers, dividing them by ,or a space. Let them say that the user is allowed to enter only 4 numbers max. So, how do I do multiple validation if the user enters, for example, ( 1 2 4 3 )or (1 2 3)? Because it would be impractical to check every choice made. (currently I am checking only 4 options 1, 2 3 or 4), since he cannot make a choice for more than 4
String choose = JOptionPane.showInputDialog(null, ("Some text"));
int userchoice = Integer.parseInt(choose);
if(userchoice ==1){
}
source
share