Forked from leandrogilvalle/gist:7f30c0a276e28d8d9dc9dd06155b324d
Created
January 10, 2023 00:10
-
-
Save josivantarcio/5b1e4cb84b287d7fec80c8885366e998 to your computer and use it in GitHub Desktop.
Java - Mostrar a quantidade de linhas no arquivo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void imprimirQuantidadeLinhasArquivo() throws IOException { | |
File arquivoLeitura = new File("arquivo.txt"); | |
LineNumberReader linhaLeitura = new LineNumberReader(new FileReader(arquivoLeitura)); | |
linhaLeitura.skip(arquivoLeitura.length()); | |
int qtdLinha = linhaLeitura.getLineNumber(); | |
System.out.println("Quantidade de Linhas no arquivo: " + qtdLinha); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment