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 trialayub ali
Courses Plus Student 723 Pointswhat is parseInt
someone explain this to me please
2 Answers
Harb Alnasser Alabdalrahim
553 PointsIt is a method used to get a primitive data type of a certain string. for example: String ageAsString = console.readLine("How old are you? "); int age = Integer.parseInt(ageAsString); here you will get an integer from a string.
james south
Front End Web Development Techdegree Graduate 33,271 Pointsit parses a string into an integer. so something like '888' is a string and parseInt would return an integer. if the string doesn't contain a parsable number, like 'myString' it would throw an error.