I am a begginer and I merged 2 training files that each worked on thier own and actually got it to run but the output is off
you put in a number from the array and get something wierd out who knows why
Enter a number to search for
49 not in the array
BUILD SUCCESSFUL (total time: 7 seconds)
sounds like a bad joke
You're assuming that System.in.read() will read the entire number you typed in - it doesn't, it just reads a single character (or byte, actually, but those are identical here). "49" happens to be the numerical presentation (in the ASCII code) of the character "1".
The java.util.Scanner class (which you can wrap around System.in) allows you to read entire numbers.
posted 4 years ago
OK thanks! i'll go back and read about the scanner again.