Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the operator for "Less than or Equal to" in Java?

Tags:

java

equals

I am familiar with Actionscript programming, and I often used the "<=" (less than or equal to) or ">=" (greater than or equal to) operators.

However in Eclipse, I have been unable to use such operators. Here's my situation. Defined variable:

final EditText UserNumber = (EditText) findViewById(R.id.editText1);

And here's the use:

if (UserNumber <= 10){ }

I'm sure this is a very easy/quick fix but I have been unable to locate what should be used in this situation.

And this is the error I'm getting:

The operator <= is undefined for the argument type(s) EditText, int

like image 550
Inferno Avatar asked Dec 12 '22 05:12

Inferno


1 Answers

As the error clearly states, you can't compare an EditText instance to a number.

You probably want to get the EditText's value.

like image 83
SLaks Avatar answered Jan 03 '23 05:01

SLaks