0

conditional, decimal, Java (condicional decimales java)

Guys I do not know if anyone knows what the error is in this expression //Chicos no se si alguno sepa cuál es el error en esta expresión if (altura >= 0,1 && altura < 2,5) { System.out.println("Error"); } It generates the error when putting the decimals as a valid range, or how can I write it? what height is valid between 0.1 and 2.5 if not so print "Error" //me genera el error al poner los decimales como rango valido, o como lo puedo escribir? que altura es válida entre 0,1 y 2,5 de no ser asi que imprima "Error"

23rd Jul 2021, 1:01 PM
Diana Miranda
Diana Miranda - avatar
2 odpowiedzi
+ 2
In general, except system settings were used to specify otherwise, decimal separator symbol is '.' (period) and digit grouping symbol is ',' (comma). If you write the floating point literal as 0.1 rather than 0,1 and also 2.5 rather than 2,5 - I think the code might run.
23rd Jul 2021, 1:33 PM
Ipang
+ 1
Thanks!
23rd Jul 2021, 1:39 PM
Diana Miranda
Diana Miranda - avatar