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
Aaron Coursolle
18,014 PointsGeeky Question: Why do we get a Boolean in the REPL?
In previous cases of using string values in the REPL we just get our string values echoed back to us; but when he types this:
java> fruit.add("cherry");
we get a boolean value:
java.lang.Boolean res2 = true
Background: We are adding array values on the fly thanks to this code:
List<String> fruit = new ArrayList<String> ();
1 Answer
anil rahman
7,786 PointsBecause it's like succeeded command or not succeeded or is not valid and is valid.
So when you do add a fruit to array it says true because it succeeded and an item has been added.
Plus it's probably a simple way of giving feedback to you as a user.