October 2017
Beginner
318 pages
7h 26m
English
What if we want to check and see whether our input string contains both the strings, namely sOne and sTwo? There's a couple of ways to do this, and we'll take a look at some others. But probably, the simplest way for our purposes is to use a complex conditional on the if(input.contains(sOne)) line. Java allows us to evaluate multiple true or false statements, or Boolean objects, at once using the && or the | conditional operator. The && operator gives us a true result when all conditionals compared with the && operator have evaluated to true. The | operator gives us a true result when any of the conditionals compared with the | operator evaluate to true. In our case, we want to know whether our input string ...
Read now
Unlock full access