title: java code that i am unable to rectify
body: <p>I wrote this java code for a project I am working on. I have gone as far as I can, but still can't get it to work, so I thought I would try here.</p>
  
  <p>The program is supposed to use a <code>JOptionPane</code> to ask the user what to city's he would like to see the mileage distance between. Those numbers come from a .txt file.</p>
  
  <p>I always get an error that "j" cant be found.</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.Scanner;
  import javax.swing.JOptionPane;
  
  public class Mileage
  {
      public static void main(String[] paramArrayOfString)
      throws IOException
      {
          String str3 = "";
  
          Scanner localScanner = new Scanner(new File(JOptionPane.showInputDialog("Enter the name of the data file.")));
  
          String str1 = localScanner.nextLine() + " Cities:\n\n";
  
          int i = localScanner.nextInt();
  
          ArrayList localArrayList = new ArrayList(i);
  
          int[][] arrayOfInt = new int[i][i];
          for (int j = 0; j &lt; i; j++)
          {
              localScanner.nextLine();
              localArrayList.add(localScanner.nextLine());
              for (int k = 0; k &lt; i; k++) 
              {
  
                  arrayOfInt[j][k] = localScanner.nextInt();
              }
          }
          j = 1 ;
          for (String str4 : localArrayList)
          {
              str1 = str1 + j++ + ". " + str4 + "\n"; str1 = str1 + "\nEnter from and to cities for mileage, \"Quit\" or \"quit\" to quit.";
              String str2;
          }
          do 
          {
              str2 = JOptionPane.showInputDialog(str3 + str1);
              if (str2.equalsIgnoreCase("quit"))
              {
                  continue;
              }
              localScanner = new Scanner(str2);
              int m = localScanner.nextInt();
              int n = localScanner.nextInt();
              if ((m &lt; 1) || (m &gt; i) || (n &lt; 1) || (n &gt; i))
                  str3 = "Invalid values, try again.\n\n";
              else {
                  str3 = "The distance between " + (String)localArrayList.get(m - 1) + " and " + (String)localArrayList.get(n - 1) + " is " + arrayOfInt[(m - 1)][(n - 1)] + " miles.\n\n";
              }
          }
  
          while (!str2.equalsIgnoreCase("quit"));
      }
  }
  </code></pre>
  
  <p>and here is another form I tried, little is different, but both have same error:</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.io.PrintStream;
  import java.util.ArrayList;
  import java.util.Scanner;
  import javax.swing.JOptionPane;
  
  public class MileageTest
  {
      public static void main(String[] paramArrayOfString)
      throws IOException
      {
          String str5 = "";
  
          String str1 = JOptionPane.showInputDialog("Enter the name of the data file.");
          Scanner localScanner = new Scanner(new File(str1));
  
          String str2 = localScanner.nextLine();
  
          int i = localScanner.nextInt();
  
          ArrayList localArrayList = new ArrayList(i);
  
          int[][] arrayOfInt = new int[i][i];
          for (int j = 0; j &lt; i; j++)
          {
              localScanner.nextLine();
              localArrayList.add(localScanner.nextLine());
              for (int k = 0; k &lt; i; k++) 
              {
                  arrayOfInt[j][k] = localScanner.nextInt();
              }
          }
          String str3 = str2 + " Cities:\n\n";
          j = 1;
          for (String str6 : localArrayList)
              str3 = str3 + j++ + ". " + str6 + "\n"; 
              str3 = str3 + "\nEnter from and to cities for mileage, \"Quit\" or \"quit\" to quit.";
              String str4;
          do {
              str4 = JOptionPane.showInputDialog(str5 + str3);
              if (str4.equalsIgnoreCase("quit"))
                  continue;
              localScanner = new Scanner(str4);
              int m = localScanner.nextInt();
              int n = localScanner.nextInt();
              if ((m &lt; 1) || (m &gt; i) || (n &lt; 1) || (n &gt; i))
                  str5 = "Invalid values, try again.\n\n";
              else 
              {
                  str5 = "The distance between " + (String)localArrayList.get(m - 1) + " and " + (String)localArrayList.get(n - 1) + " is " + arrayOfInt[(m - 1)][(n - 1)] + " miles.\n\n";
              }
          }
  
          while (!str4.equalsIgnoreCase("quit"));
          test();
      }
  
     private static void test()
     {
          System.out.println("Testing...");
     }
  }
  </code></pre>