Abrir um arquivo txt

1 resposta
S

Olá galera…

Queria saber como faço pra abrir um determinado arquivo txt já existente…

Grato,

Semsar

1 Resposta

S
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;


public class LerArquivo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			BufferedReader in = new BufferedReader(new FileReader("c:\\teste.txt"));
	        String str;
	        while ((str = in.readLine()) != null) {
	            System.out.println(str);
	        }
	        in.close();
	    } catch (IOException e) {
	    }
	}

}
Criado 1 de janeiro de 2008
Ultima resposta 2 de jan. de 2008
Respostas 1
Participantes 2