title: Yes/No with boolean or if/else?
body: <p>I'm having issues creating a yes/no input in my program. I want the user to be able to input a y/n after the last print statement, but i'm not quite sure how I would implement it. I know it would most likely include a boolean or an if/else statement, but i'm not quite sure. Any help?</p>
  
  <pre><code>import java.util.*;
  import java.io.*; 
  import java.util.Scanner;
  
  public class Person 
  {
  public static void main(String[]args) 
  {
  
      int age;
      String name;
  
      Scanner scan = new Scanner(System.in);
  
      System.out.println("Enter in your age.");
      age = scan.nextInt();
  
          if (age &gt;= 10 &amp;&amp; age &lt; 18) 
          {
              System.out.println("So you're a kid, huh?");
          } 
  
          else if (age &lt; 10)
          {
              System.out.println("Nice try.");
              System.exit(0);
          }
          else if (age &gt;= 18 &amp;&amp; age &lt;= 100)
          {
              System.out.println("So you're an adult, huh?");
          }
          else if (age &gt; 100)
          {
              System.out.println("Nice try.");
              System.exit(0);
          }
  
          Scanner in = new Scanner(System.in);
          System.out.println("Enter in your name");
          name = in.nextLine();
  
          System.out.println("So you're " + age + " years old and your name is " + name + "?");
  
          System.out.println("y/n");
          }
  }
  </code></pre>