import java.io.IOException;
import java.util.Scanner;
public class Chapter_3_Self_Test {
public static void main (String args []) throws IOException {
Scanner sc = new Scanner (System.in);
char a;
for (int counter = 0; a == '.'; counter++) {
a = (char) System.in.read();
}
System.out.println(counter);
}
}
I'm a beginner at Java. When I run this code, I get the error message that counter cannot be resolved to a variable. How do I fix this? I tried converting counter to a string, but that did nothing.