I am writing a java class for accepting conditional user input through console as follows:- +++++++++++++++++++++++++++++++++++++++++++ Enter your choice as below:- Press '1' for add new item. Press '2' for add edit item. Press '3' for add remove item. +++++++++++++++++++++++++++++++++++++++++++
Now if someone enters values other than 1,2 or 3 it should display message as follows:-
+++++++++++++++++++++++++++++++++++++++++++ 4 You have entered invalid input, Please enter again!!! 1 Enter Item Details:-
& So on..... +++++++++++++++++++++++++++++++++++++++++++
Could you please help me how to achieve this?
I want a conditional input, i.e, if user enters invalid input then it should prompt him for entering again one of above commands.