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 trialKosta Kuts
15,894 PointsInteger numberOfPeople = 3;
is it wrong?
Integer numberOfPeople = 3;
4 Answers
Steve Hunter
57,712 PointsI'm assuming this is creating a new integer variable, which is something like:
int numberOfPeople = 3;
I'll have a look at the challenge associated with the question.
Steve.
Steve Hunter
57,712 PointsSmall 'i', I think - integer isn't capitalised.
Steve.
leong shing chew
5,618 PointsPrimitive int is not capitalized but the object one is.
Though you probably have to use a constructor to initialized it.
Integer numberOfPeople = new Integer(3); <-though this depend on the version of java, the later versions probably allow what you are trying to do.
java 8 doc on Integer http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html
Seth Kroger
56,413 PointsThough it is fine to use the class Integer versus the primitive int in your own code, the challenge checker is probably looking specifically for an int.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsYes, that code passes the first part of the challenge.