Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package LerTXT;
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- public class LeCamposPorLinha {
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new FileReader("in.txt"));
- String linha = br.readLine();
- while (linha != null) {
- String[] vals = linha.split("[ \t]");
- String cpf = vals[0]; // obtem campos
- String nome = vals[1];
- int risco = Integer.parseInt(vals[2]);
- // Imprime os valores lidos separados por '/'.
- System.out.printf("%s/%s/%d\n", cpf, nome, risco);
- // Lê próxima linha.
- linha = br.readLine();
- }
- br.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement