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 trialAdam Brown
1,893 PointsInteger.parseInt() use.
I understand why we need to change a string to an integer, but I don't fully grasp what the reasoning for this code is. What is the "Integer" part for in the beginning of this code?
1 Answer
Michael Hess
24,512 PointsHi Adam,
The Integer class, in Java, is something called a wrapper class. A wrapper takes a primitive data type such as an integer and wraps it in an object.
The Integer part is needed because we are using the Integer class -- parseInt() is a method that's part of the Integer class.
Here are some external resources that you may want to read:
parseInt() Tutorial at Tutorials Point
If you have any questions feel free to ask! Hope this helps!