powered by
Creates a new Java object and invokes the constructor with given arguments.
new
signature(Class = "jclassName"): ...
signature(Class = "jclassName")
The new method is used as the high-level API to create new Java objects (for low-level access see .jnew). It returns the newly created Java object.
.jnew
... arguments are passed to the constructor of the class specified as J("class.name").
...
J("class.name")
.jnew, jclassName-class
jclassName-class
if (FALSE) { v <- new(J("java.lang.String"), "Hello World!") v$length() v$indexOf("World") names(v) }
Run the code above in your browser using DataLab