import java.io.*;
public class Main {
public static void main(String[] args) {
try {
Reader reader = new FileReader("example.txt");
int data;
while ((data = reader.read()) != -1) {
System.out.print((char) data);
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
Reader reader = new FileReader("example.txt");
BufferedReader bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null) {
System.out.println(line);
}
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
import java.io.*;
public class Main {
public static void main(String[] args) {
try {
Reader reader = new InputStreamReader(new FileInputStream("example.txt"), "GBK");
int data;
while ((data = reader.read()) != -1) {
System.out.print((char) data);
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}