Réponse acceptée !
Salut a vous deux,
Voici ta classe modifié :
public class Ecrire { public static void main(String [] arg) { String tmp =""; char A ='\0'; while (A != '\n') { try{ A = (char)System.in.read(); } catch(java.io.IOException e){System.out.println(e.toString()); } if (A != '\r' && A != '\n') tmp = tmp + A; } } }
|
L'erreur venait du fait que tu lisais un flux sans savoir si il y allait avoir de problemes pendant la lecture....
Il faut jeter dans ce cas une exception en utilisant un bloc try catch
de la sorte :
try{ //ton instruction qui peut generer une erreur } catch(java.io.IOException e){ //que faire en cas d'erreure d'entree/sortie }
|
Ce bloc sutilise un peux partout des qu'il ya des exceptions a jeter, ne l'oubli pas,c ton ami :o)
Voili voulou
Sur ce +++
##########################
# Alphaspawnrider@Yohann
# alphaspawnrider@hotmail.com
##########################