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

node.js - StackOverflow API not returning JSON -

python - Subclassed QStyledItemDelegate ignores Stylesheet -

sql server - TFS 2012 TF255062 Error after removing 'Active Directory' Role -