When compiling arrays in the output it gives me ? instead of a value

Viewed 46
public class game {

public static void main(String args[]) { 
    
   Scanner guess = new Scanner(System.in);
             
   int[] numbers = 
   {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97} ; 
   
   System.out.println("enter your 1st guess: "); 

   int first = guess.nextInt();
             
   System.out.println("enter your 2nd guess: ");

    int second = guess.nextInt();

    Arrays.sort(numbers);

    System.out.printf("%d found at index = %d \n" , first, 
    Arrays.binarySearch(numbers, first));

    System.out.printf("%d found at index = %d " , second, 
    Arrays.binarySearch(numbers, second));
             
    }
}   
0 Answers
Related