Exception java

cabistos Messages postés 26 Statut Membre -  
KX Messages postés 19031 Statut Modérateur -
Bonjour,
quand j'ai ajouté cette méthode a ma classe mon programme m'affiche :Exception in thread "main" java.lang.NullPointerException
at allégerfile.maClass.rejetChap(maClass.java:26)
at allégerfile.maClass.main(maClass.java:85)

voici la méthode
aidez moi svp

public static boolean rejetChap (String in) throws IOException{
chapin = new BufferedReader(new FileReader("D://pfe//chap rejeté.txt"));
String chapline = chapin.readLine();

while (chapin != null && chapline.equals(in.substring(267,277)) ==false){chapline=chapin.readLine();} chapin.close();
if (chapline == null) return false ;
else return true;
}


A voir également:

1 réponse

KX Messages postés 19031 Statut Modérateur 3 020
 
Bonjour,

Dans ta boucle while ce n'est pas chopin qu'il faut tester à null mais chopline...
0