Skip to content

Instantly share code, notes, and snippets.

@inmyth
Created November 3, 2018 03:16
Show Gist options
  • Select an option

  • Save inmyth/b20b2ee686a4a05403900a7b07bfb978 to your computer and use it in GitHub Desktop.

Select an option

Save inmyth/b20b2ee686a4a05403900a7b07bfb978 to your computer and use it in GitHub Desktop.
Dynamic instantiation
val o = Class.forName("me.mbcu.dapackage.TwoStringConstructorClass").getConstructors()(0)
val args = Array[AnyRef]("aaaa", "bbbb")
val c = o.newInstance(args:_*).asInstanceOf[ParentAbstractClass]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment