title: Why do I need an identifier for my for loop when the variables are already declared?
body: <p>Can someone tell me what's wrong with my <code>for loop</code>? I have been spending a lot of time trial and error and researching on the internet but I still can't find a solution. It keeps on saying that an identifier expected cannot find symbol. Please help thanks!</p>
  
  <pre><code>package imageviewer;
  
  import java.awt.Color;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.util.Scanner;
  import java.util.Vector;
  import javax.swing.ImageIcon;
  import javax.swing.JButton;
  import javax.swing.JLabel;
  import javax.swing.JOptionPane;
  import javax.swing.JPanel;
  
  public class ImageViewer extends JPanel implements ActionListener {
  
      JPanel bottomPanel;
      JLabel imageLabel;
      JButton previousBtn;
      JButton nxtBtn;
  
      ImageViewer()
      {
          imageLabel = new JLabel("Image Display");
          imageLabel.setBackground(Color.WHITE);
          imageLabel.setOpaque(true);
          add(imageLabel);
  
          previousBtn = new JButton("Previous");
          previousBtn.addActionListener(this);
          add(previousBtn);
  
          nxtBtn = new JButton("Next");
          nxtBtn.addActionListener(this);
          add(nxtBtn);
      }
  
      String userInput = JOptionPane.showInputDialog("Please input name of first image file");
      Scanner myScanner = new Scanner(userInput);
      String fileDetail = myScanner.next();
      String[] arr = fileDetail.split("\\.");
  
      String fileName = arr[0].replaceAll("[0-9.]", "");
      String fileNumber = arr[0].replaceAll("[^0-9]", "");
      String fileFormat = arr[1];
  
      int num = Integer.parseInt(fileNumber);
  
      String totalImage = JOptionPane.showInputDialog("Please enter the number of images in total");
      Scanner secondScanner = new Scanner(totalImage);
      int numberInput = secondScanner.nextInt();
  
      ImageIcon imageGraphic = new ImageIcon(fileName + fileNumber + "." + fileFormat);
  
      Vector &lt;String&gt; imageDetail = new Vector &lt;String&gt;();
      int total = (num + numberInput);
  
      for(int i = num; i &lt; total; i++)
      {
      }
  
  
  public void actionPerformed(ActionEvent e)
      {
      }
  
  }
  </code></pre>