Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have an IF OR in android?

Tags:

java

android

  if(word.equals(" ")){
  }

I have this IF statment, what i would like it to also do is the following..

 if(word.equals(" ") OR word.equals(".") ){
  }

I know the above code will not work, but im looking how to implement something like that? Anyone know how to do an if or, or do i have to use else if?

like image 551
Beginner Avatar asked Nov 27 '22 18:11

Beginner


1 Answers

Android uses Java, and the boolean OR operator in Java (and in pretty much every single language with a C-inspired syntax) is ||.

if (word.equals(" ") || word.equals("."))

Here is a document describing the Java operators. You may also want to read it from the start since it covers the basics of Java.

There are thousands of tutorials on Google explaining the basics of the Java language that you could also use.

like image 152
zneak Avatar answered Nov 30 '22 07:11

zneak