Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Basics Perfecting the Prototype Using Logical ORs and ANDs

i cant solve this plz help

Assuming that Sara has taken the Java and Python tracks, what is the value of isFamiliar below:

boolean isFamiliar = ( learnedJava || learnedPython || learnedRuby );

1 Answer

Luciano Bruzzoni
Luciano Bruzzoni
15,518 Points

Hello, The value would return 'true' in this case because as you mentioned Sara learnedJava and learnedPython (took the tracks). This is so because the statement is asking if Sara learned java OR ( || ) python OR ruby, so if any of those are true the result will be true. If Sara had only learned java, it would return true as well because you only need one statement to be true. OR (||) means only one item needs to be true for the statement to be true. AND (&&) means all items need to be true in order for the statement to be true.

Hope that helped!