title: How do I declare String from result of IF Statement?
body: <p>I have been playing around and testing out some of the stuff I learned, and this isn't working for me for some reason. It's only mid-app, but I keep running it during development to make not have a thousand problems pile up by the time I'm done. It should be able to run as is though.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Speed {
      public void speedAsker(){
          Scanner scan = new Scanner(System.in);
  
          System.out.println("Should we use: 1.KMPH or 2. MPH");
          int s1 = scan.nextInt();
          if(s1==1){
              String j1 = "KMPH";
              System.out.println("We will be using Kilometres for this calculation.");
          }if(s1 ==2){
              String j1 = "MPH";
              System.out.println("We will be using Miles for this calculation.");
          }else{
              System.out.println("That is an invalid input, you must choose between 1 or 2.");
          }
          System.out.println("What speed is your vehicle going in?");
          int d1 = scan.nextInt();
          System.out.println("Your vehicle was going at " + d1 + j1 + ".");
      }
  }
  </code></pre>
  
  <p>This i what I got for output. The launcher class is just literally launching this class, I'm just doing it for good practice. The issue I'm having is trying to label j1 based on answer and use it in my output afterwards.</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.Error: Unresolved compilation problem:<br/>
            j1 cannot be resolved to a variable<br/>
            at Speed.speedAsker(Speed.java:28)<br/>
            at Launcher.main(Launcher.java:7)<br/></p>
  </blockquote>
  
  <p>Thanks in advance.</p>