在Java编程语言中,表示小于的运算符是
在Java中,
inta=5intb=10
booleanisLessThan=(a
/isLessThan的值为true
booleanisLessThanEqual=(a
/如果a小于b或者a等于b,则结果为true
循环for(inti=0
i++){
System.out.println(i)
条件语句if(aSystem.out.println("aislessthanb")
else{
System.out.println("aisnotlessthanb")
在比较浮点数时,由于浮点数的精度问题,直接使用
BigDecimala=newBigDecimal("5.0001")BigDecimalb=newBigDecimal("5.0002")
booleanisLessThan=a.compareTo(b)
/结果为true
Stringstr1="apple"
Stringstr2="banana"
booleanisLessThan=str1.compareTo(str2)
/结果为true
在Java中,使用