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 trialzombiemk7
1,076 PointsWhat is this happening ?
In Java repl, I created a List of String and added three fruits in it. But it shows List of String when i simply write "fruit".
fruit
java.util.List<java.lang.String> fruit = [apple, peach, watermelon]
And shows ArrayList when i write "fruit;"
fruit;
java.util.ArrayList res17 = [apple, peach, watermelon]
Why is this happening and why i am getting different results for both of them ?
1 Answer
markmneimneh
14,132 PointsHello
I believe you meant to type:
"apple", "peach", "watermelon"
if this answers your question, please mark the question as answered.
Thanks
codebyamir
12,108 Pointscodebyamir
12,108 PointsCan you post how you created the list?