Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя Sibin_Thomas

Автор Sibin_Thomas, история, 4 года назад, По-английски

I wanted to take input from a file and print output to another file. I am able to take the input successfully(Tested using System.out) but there is no output on the output file.

import java.util.*;
import java.io.*;

class a{

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	public a() throws Exception{
		if (System.getProperty("ONLINE_JUDGE") == null) {
			br = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter(new FileWriter("output.txt"));
		}
		else {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}
	}

	public void solve() throws IOException{
		int n = Integer.parseInt(br.readLine());
		out.println(n);
		out.flush();
	}

	public static void main(String[] args) throws Exception{
		new a().solve();
	}
}
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится