← Docs
kotlin-stdlib / kotlin.reflect.full / createInstance

createInstance

JVM
1.1
fun < T : Any > KClass < T > . createInstance ( ) : T
(source)

Creates a new instance of the class, calling a constructor which either has no parameters or all parameters of which are optional (see KParameter.isOptional ). If there are no or many such constructors, an exception is thrown.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .