Answers for "bufferedreader java 8 docs"

5

java read file bufferedreader

try {
	File file = new File("data.txt");
	BufferedReader reader = new BufferedReader(new FileReader(file));
	String line;

	while((line = reader.readLine()) != null) {
	 	 System.out.println(line);
	}
} catch(IOException e) {
  	e.printStackTrace();
}
Posted by: Guest on June-22-2020
0

java bufferedreader

private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st;
static String next() throws IOException {
    while (st==null||!st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine().trim());
    }
    return st.nextToken();
}
static long readLong() throws IOException {
    return Long.parseLong(next());
}
static int readInt() throws IOException {
    return Integer.parseInt(next());
}
static double readDouble() throws IOException {
    return Double.parseDouble(next());
}
static String readLine() throws IOException {
    return br.readLine().trim();
}
Posted by: Guest on March-01-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language