I wrote a loop, but it doesn't work. It should ask me 4 times for a and for every a it should write numbers from 0 to 3. But after asking it writes two numbers. Where is mistake?
My code is
package hra1;
public class Hra1 {
public static void main(String args[]) throws java.io.IOException
{
char a;
int i;
for (i = 0; i < 4; i++)
{
a = (char) System.in.read();
System.out.println(i);
}
}
}
Here is an example of the output:
l
0
1
l
2
3