; expected (savoir si un fichier existe)
Bonjour tout le monde,
Nous apprenons pour l'instant le travail sur les fichiers en JAVA.
J'ai un petit souci, quand j'essaie de savoir si un fichier existe ou n'existe pas, il me dit qu'il me manque un ;
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| import java.io.*;
public class testFile4
{
public static void main (String [] args)
{
String path = "c:\\PIA";
int typeFichier(path);
if (type = 0)
System.out.println("n'existe pas !");
else
System.out.println("Existe !");
}
public static int typeFichier (String path)
{
int type;
if (!path.exists)
type = 0;
return type;
}
} |
Et le message d'erreur est le suivant :
Merci d'avance pour votre aide et bon dimanche.
beegees