title: Using Scanner to change boolean in java
body: <p>This is my first post here, so I decided to browse around various posts here in order to try and get a feel for how questions should be posted. </p>
  
  <p>Hence, if I mess up please let me know so I can fix my post accordingly ASAP. </p>
  
  <p>So here is my problem: </p>
  
  <p>I started learning Java today and I'm working on just getting a feel for how everything works. I have the code below set to tell if kids are good or bad and display corresponding replays. </p>
  
  <p>Good kids get candy, bad kids get none. I want to be able to limit the users choices to good or bad and have their answer change the <code>Boolean</code> to <code>true</code> or <code>false</code> to run the right <code>if</code> statement. </p>
  
  <p>I saw a <code>Math.random</code> way of doing it but when I tried it I got more problems. </p>
  
  <p>Thank you for your time. </p>
  
  <p>The following is my code:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Main {
      public static void main (String args[]) {
          //take user info 
          Scanner sc = new Scanner(System.in);
  
          int candy = 12;
          int kids = 4;
          int bad = 1;
          String a = sc.nextLine();
          int answer = candy / kids;
          String answer2 = "No Candy";
          boolean good = false;
  
          System.out.println(a);
          //closeing the scanner
          sc.close();
  
          if(bad == 1) {
              System.out.println(answer2);
          } else {
              if(bad == 2)
                  good = true;
              System.out.println(answer);
          }
          if(good == true) {
              System.out.println("Good Job");
          } else {
              System.out.println("Try again tomorrow!");
          }
      }
  }
  </code></pre>