# What is the Kotlin equivalent of Java's MyClass.class?

**URL:** <https://discuss.kotlinlang.org/t/what-is-the-kotlin-equivalent-of-javas-myclass-class/1221>\
**Category:** Uncategorized\
**Created:** [April 10, 2012, 1:35pm UTC](https://discuss.kotlinlang.org/t/what-is-the-kotlin-equivalent-of-javas-myclass-class/1221 "2012-04-10T13:35:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianclarke](https://avatars.discourse-cdn.com/v4/letter/i/7bcc69/32.png) [@ianclarke](https://discuss.kotlinlang.org/u/ianclarke)\
**Post date:** [April 10, 2012, 1:35pm UTC](https://discuss.kotlinlang.org/t/what-is-the-kotlin-equivalent-of-javas-myclass-class/1221/1 "2012-04-10T13:35:25Z")

</div>

I want to get the Class object for a given Class, in Java I'd use the .class static field - how can I do this in Kotlin?

I would guess that I would use the typeinfo() method, however this doesn’t seem to have been implemented yet :-/

---

<div class="post-metadata">

**Author:** ![Frostman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/frostman/32/1617_2.png) [@Frostman](https://discuss.kotlinlang.org/u/Frostman)\
**Post date:** [April 10, 2012, 1:41pm UTC](https://discuss.kotlinlang.org/t/what-is-the-kotlin-equivalent-of-javas-myclass-class/1221/2 "2012-04-10T13:41:49Z")

</div>

You can use javaClass\<MyClass\>

---

<div class="post-metadata">

**Author:** ![chammers](https://avatars.discourse-cdn.com/v4/letter/c/bc8723/32.png) [@chammers](https://discuss.kotlinlang.org/u/chammers)\
**Post date:** [April 10, 2012, 1:42pm UTC](https://discuss.kotlinlang.org/t/what-is-the-kotlin-equivalent-of-javas-myclass-class/1221/3 "2012-04-10T13:42:41Z")

</div>

I use this with junit where I would say NullPointerException.class in Java:&nbsp;&nbsp;Class\<NullPointerException\>

---

<div class="post-metadata">

**Author:** ![ianclarke](https://avatars.discourse-cdn.com/v4/letter/i/7bcc69/32.png) [@ianclarke](https://discuss.kotlinlang.org/u/ianclarke)\
**Post date:** [April 10, 2012, 8:40pm UTC](https://discuss.kotlinlang.org/t/what-is-the-kotlin-equivalent-of-javas-myclass-class/1221/4 "2012-04-10T20:40:06Z")

</div>

Thanks!
