rendered paste bodyimport static pt.ua.prog.WIO.*;
import java.io.*;
class ex4Teste
{
public static void main(String [] args) throws IOException
{
BufferedReader br;
BufferedWriter bw;
String inFile = "input.txt";
String outFile = "output.txt";
try
{
br = new BufferedReader(new FileReader(inFile));
}
catch(Exception e)
{
println("Erro a abrir ficheiro de input");
return;
}
try
{
bw = new BufferedWriter(new FileWriter(outFile));
}
catch(Exception e)
{
println("Erro a abrir ficheiro de output");
return;
}
int tiragens = 0;
String s;
try
{
do
{
s = br.readLine();
if(s!=null)
tiragens++;
}while(s!=null);
bw.write("O jornal teve " + tiragens + " tiragens\n");
}
catch(Exception e)
{
println("Erro a ler/escrever");
}
br.close();
bw.close();
}
}