# Java interop: overriding methods mixing boxed and unboxed types

**URL:** <https://discuss.kotlinlang.org/t/java-interop-overriding-methods-mixing-boxed-and-unboxed-types/20963>\
**Category:** Support\
**Created:** [February 24, 2021, 5:38am UTC](https://discuss.kotlinlang.org/t/java-interop-overriding-methods-mixing-boxed-and-unboxed-types/20963 "2021-02-24T05:38:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alamothe](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@alamothe](https://discuss.kotlinlang.org/u/alamothe)\
**Post date:** [February 24, 2021, 5:38am UTC](https://discuss.kotlinlang.org/t/java-interop-overriding-methods-mixing-boxed-and-unboxed-types/20963/1 "2021-02-24T05:38:29Z")

</div>

Hello,  
I am overriding in Kotlin a Java class with the following methods:

```auto
  public JsonWriter value(boolean value) throws IOException {
    // ...
  }

  public JsonWriter value(Boolean value) throws IOException {
    // ...

```

**My class will be used from both Kotlin and Java code (unfortunately).**

Is there any way to override both methods in Kotlin?

Which one gets overridden if I do:

```auto
override fun value(value: Boolean): JsonWriter {

```

Thanks!

---

<div class="post-metadata">

**Author:** ![kyay10](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@kyay10](https://discuss.kotlinlang.org/u/kyay10)\
**Post date:** [February 24, 2021, 8:38am UTC](https://discuss.kotlinlang.org/t/java-interop-overriding-methods-mixing-boxed-and-unboxed-types/20963/2 "2021-02-24T08:38:43Z")

</div>

`override fun value(value: Boolean): JsonWriter {` this overrides the primitive `boolean`. To override the boxed `Boolean`, use a nullable boolean: `override fun value(value: Boolean?): JsonWriter {`
