java - Using "or" statements with strings in an if statement -


so want make code categorizes words match phrase. catstring string inputted user. want execute rest of code if input fire or smoke.

here's line i'm having trouble with:

if(catstring = "fire" || "smoke" ); 

you need repeat catstring =. however, should not using == (not =, assignment operator) compare strings. use .equals(). like:

if(catstring.equals("fire") || catstring.equals("smoke")); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -