ведь по умолчанию int count и без инициализации должен быть =0. Но в таком случае инкремент ругается, почему так происходит?
public class Solution {
public static void main(String[] args) throws IOException {
FileInputStream fis=new FileInputStream(new BufferedReader(new InputStreamReader(System.in)).readLine());
int count=0; // если не инициализировать 0 , код не работает
while (fis.available() > 0) {
int item=fis.read();
if(item==44) {
count++;
}
}
fis.close();
System.out.println(count);
}
}