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
Post a Comment