How can I replace static value in an array? i want user's first input to be placed at first index.
Scanner input = new Scanner(System.in);
int[] arr = {0,0,0,0,0};
int seat = input.nextInt();
if(seat >=1 || seat <=5)
{
//how can i assign first input to index 0 permanently?
}
arr[0] = seat;.&&in your logical if. The way you have it written will always result in atruestatement. Any number which isfalsewith the first condition will betruewith the second, and vise versa.