title: Scanning different types of variables in one line
body: <p>As the title says, I would like to scan the whole line of input just using one input from user. The input should be like "Eric 22 1".</p>
  
  <p>If <code>nextString()</code> shouldn't be used that way, should I just use <code>hasNext</code>?</p>
  
  <p>JAVA CODE :</p>
  
  <pre><code>import java.util.Scanner;
  
  public class tugas1
  {
      public static void main(String []args)
      {
          String name;
          int age;
          boolean sex;
  
          Scanner sc = new Scanner(System.in);
  
          System.out.println("Please input your name, age, and sex(input 1 if you are a male, or 0 if you are a female) :");
          name = sc.nextString();
          age = sc.nextInt();
          sex = sc.nextBoolean();
  
          if(isString(name))
          {
              if(isInteger(age))
              {
                  if(isBoolean(sex))
                  {
                      System.out.println("Correct format. You are :" +name);
                  }
                  else
                  {
                      System.out.println("Please input the age in integer");
                  }
              }
              else
              {
                  System.out.println("Please input the age in integer");
              }
          }
          else
          {
              System.out.println("Please input the name in string");
          }
      }
  }
  </code></pre>
  
  <p>After adding and editing the lines :</p>
  
  <pre><code>System.out.println("Please input your name, age, and sex(input 1 if you are a male, or 0 if you are a female) :");
      String input = sc.nextLine();
  
  String[] inputAfterSplit = input.split(" ");
  
  String name = inputAfterSplit[0];
  int age = Integer.parseInt(inputAfterSplit[1]);
  boolean sex = Boolean.parseBoolean(inputAfterSplit[2]);
  </code></pre>
  
  <p>I would like to add if(name instanceof String). I haven't touched Java since a long time and I forgot is that the way of using instanceof, or is that wrong?
  The point is I want to compare if the input var is in int or string or bool.</p>
  
  <pre><code>if(name instanceof String)
  {
      if(age instanceof Integer)
      {
          if(sex instanceof Boolean)
          {    
              System.out.println("All checked out")
          }
          else
          {
              System.out.println("Not boolean")
          }
      else
      {
          System.out.println("Not int")
      }
  
  System.out.println("Not string")
  }
  </code></pre>
  
  <p>Will these lines work?</p>