Created
October 30, 2015 02:31
-
-
Save victorvaz/1da607d7b9e397ed8a78 to your computer and use it in GitHub Desktop.
Verificar a existência de um arquivo com java
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
import java.io.File; | |
public class VerificaExistenciaArquivo | |
{ | |
public static void main (String [] args) | |
{ | |
// Cria uma instancia da classe File: | |
File arquivo = new File("C://arquivo.pdf"); | |
// Usa a função exists para verificar se o arquivo existe ou não: | |
if (arquivo.exists()) | |
System.out.println("O arquivo existe!"); | |
else | |
System.out.println("O arquivo não existe!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment