0
How to know if your input is equal to a random array number?
i tried somthing like this but didnt work. int arr []= {1,2,3,4}; if(scan.equals(arr[rnd])){System.out.println("Same" );} else{System.out.println("not the same");
2 Answers
+ 2
Take the input as a number and test:
int input = scan.nextInt();
if (input == arr[rnd])
// equal
else
// not equal
0
thanks faith ill try it out đ