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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![habib kazemi](https://secure.gravatar.com/avatar/89bd1f2b23bd21c22784f63caba78c8c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
habib kazemi
2,041 PointsI dont understand the word 'new' in codes.
what the word 'new' in codes mean getAnswerButton.setOnClickListener(new View.OnClickListener()
2 Answers
![Gunjeet Hattar](https://uploads.teamtreehouse.com/production/profile-photos/364622/micro_306442_10150352465861572_82713065_n.jpg)
Gunjeet Hattar
14,483 PointsThe keyword new in Java is used to allocate memory to the objects, in short it creates the object
You will find a very precise answer here StakOverflow - What does new keyword do in Java
Hope this helps. Ask again if you doubts
![Harry James](https://uploads.teamtreehouse.com/production/profile-photos/861752/micro_harryjamesuk.png)
Harry James
14,780 PointsThe new keyword actually creates a new instance of an object. So, in theory, you're creating a new object. Be careful when using this as, you don't want to create many instances if they're not needed. This will just waste resources on the Android device. If, however, you have an object that can only be used once, a new keyword would be required to create a new instance of it. On the other hand, if you have something like an animation, you wouldn't create a new animation each time the user tapped a button for example (Unless the animation was deleted after its completion). Instead, you would have it so the animation would restart on the same instance.
Hope this clarifies things!