Je veux tester que ce String est bien un double
Bonjour ,
je dois tester que phObj est bien un nombre eventuellemetn à virgule
l'utilisateur a rentré un string au prealable
J'avais pensé à ca
Code:
1 2 3 4 5 6
|
this.ph_obj = sc.nextLine(); // lecture de la valeur ph_obj
this.ph_obj.trim();
double f = Double.parseDouble(ph_obj);
{if (f ==applet.getLFT().getPhObj() )
{et la suite ...............} |
Exception in thread "Thread-4" java.lang.NumberFormatException: For input string: "1aaa.0"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
mais ça renvoit toujorus une erreur s'il a rentré "aaaa"