FileReader reader = new FileReader("d:\\UnderTest\\AVS\\tester.txt");
char ch;
int x;
while( ( x = reader.read() ) != -1 ) {
// I use the following statement to detect EOL
if( Character.toString((char)x) == System.getProperty("line.separator") ) {
System.out.println("new line encountered !");
} System.out.print( (char)x );
}
このコードでは、tester.txt
新しい行に 2 つの文が書かれていますが、if ステートメントは機能しません。どうしてこんなことに ?