idk 如何在我不满足 space (Java) 的情况下读取文件中的字符符号

idk how to read char symbols in file while i will not meet space (Java)

我有这个代码

char c;
FileReader fr = new FileReader("text.txt");
while(true){
    c = (char)fr.read();
    if (c == ' ')
        break;
    System.out.println(c);
    }

但是当reader遇到一个space时,他没有完成工作。

问题解决了,需要查号

int c;
FileReader fr = new FileReader("text.txt");
while(true){
    c = fr.read();
    if (c == 32)
        break;
    System.out.println((char)c);
    }