+ 1
when i use scanner (nextfloat ) i get unputmismatexception
4 Réponses
+ 5
Show all their parts can you?
nextFloat() not nextfloat
It is method not property
+ 4
Is the input a float?
Post your code. Typically you'll generate such an error if the input is different than what you're trying to obtain. So if the next piece of data isn't a float, you can't use nextFloat to obtain it. You can use hasNextFloat() to check if it's a float before you do any operations with it. If it's a float, then do nextFloat(). If not, then don't.
Get what I mean?
0
public class Program
{
import java.util.Scanner ;
public static void main(String[] args) {
calmoy m = new calmoy ();
Scanner s = new Scannee(System .in);
System .out .print ("donner votre prix ")
m.setprix(s.nextfloat);
System.out.println ("prix est " + m.getprix())
}
}
0
i use set and get methode and in setmethod i writ setExemple(float d)
{
this.____= d;
}
so in scanner must use nextfloat!?