title: Using a single scanner input to assign two variables in Java
body: <p>I'm trying to create a method to search an arraylist for a student number (sNumber) that the user inputs, and then with that same input get the indexOf so it can pull data from other arraylists. The problem I'm having is I can't figure out how to do this using a single input from the user. Right now for it to work they'd have to input the sNumber twice.</p>
  
  <pre><code>while (exit == 0){
              System.out.println("Please enter the sNumber of the student you wish to find");
              Boolean x = sNumber.contains(kb.nextInt());
              int y = sNumber.indexOf(kb.nextInt());
  
              if (x = true){
                  String a = name.get(y);                        
                  int c = sNumber.get(y);
                  String d = major.get(y);
                  Double e = gpa.get(y);
  
                  System.out.println(a);                        
                  System.out.println(c);
                  System.out.println(d);
                  System.out.println(e);
               }
              else if (x = false){
                  System.out.println("This student does not exist");
  </code></pre>