Guys, I do not even know how to formulate a question. Formulated as is, so better look at the simplest code. A week ago, I started reading a tutorial on the basics of Java and solved the problem on it:
import java.io.IOException; public class Registr1 { public static void main(String[] args) throws IOException { int izm=0; for (;;) { char symbol, ignore; do { System.out.print ("Введите букву для изменения ее регистра: "); symbol = (char) System.in.read(); do { ignore = (char) System.in.read(); } while(ignore != '\n'); } while(symbol != '.' & symbol < 'A' | symbol > 'z'); if(symbol >= 'A'&&symbol <= 'Z') System.out.println ("Результат: " + (symbol+=32) + "\n"); else if(symbol >= 'a'&&symbol <= 'z') System.out.println ("Результат: " + (symbol-=32) + "\n"); if(symbol >= 'A' | symbol <= 'z') izm++; if(symbol == '.') break; } System.out.print("Количество измененных символов: " + (izm) + "\n"); } } It has a counter that gives out a value 1 more than (I guess) should have. I had to change the last line to:
System.out.print("Количество измененных символов: " + (--izm) + "\n"); Who can explain what I do not understand?