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

Android Kotlin for Java Developers Is This Thing On? Seeing Clearly

Dear Ben , I am having a problem with the debugPrint in the App.kt file, where the programme is printing Card@5ca881b5

Instead of showing the Card Details such as its value and suit from GameModel.debugPrint(), I am getting :

Card@5ca881b5

By any chance do you know why this happens? Thank you!

Ben Deitch
Ben Deitch
Treehouse Teacher

Hey Goh! I'm not sure without being able to see the code. Can you share your Card class?

1 Answer

Goh, did you change your Card class to be a data class? A normal class in Kotlin will print just the Object reference (Card@5ca881b5). The data class will have a beter toString method and will print Object's properties. Cheers