hey i need help once i run it will proceed to next one it will show error message
package test1;
import javax.swing.JOptionPane;
public class Test1 {
public static void main(String[] args) {
int counter;
int counter1=0;
int counter2=0;
int counter3=0;
int counter4=0;
JOptionPane.showMessageDialog(null,"Welcome");
for(counter=0;counter<20;)
{
int num1;
String firstinput = null ;
JOptionPane.showInputDialog("Enter a positive integer(1-9999):");
num1= Integer.parseInt(firstinput);
while (num1<1 || num1>9999)
{
JOptionPane.showInputDialog("The input number is not positive. Please enter a positive integer (1-9999):");
num1= Integer.parseInt(firstinput);
}
if(num1>=1 && num1<=9)
{
counter1++;
}
if(num1>=10 && num1<=99)
{
counter2++;
}
if(num1>=100 && num1<=999)
{
counter3++;
}
if(num1>=1000 && num1<=9999)
{
counter4++;
}
counter++;
}
JOptionPane.showInputDialog("The number of 1-digit input is:"+counter1);
JOptionPane.showInputDialog("The number of 2-digit input is:"+counter2);
JOptionPane.showInputDialog("The number of 3-digit input is:"+counter3);
JOptionPane.showInputDialog("The number of 4-digit input is:"+counter4);
JOptionPane.showInputDialog("Thank You, BYE BYE");
System.exit(0);
}
}