Current Page: NeXtMidas Training Getting Started - Part 2 Advanced Results Parameters Objects The Invoke and New Commands
- - | The `INVOKE` and `NEW` commands The `INVOKE` and `NEW` commands allow for complex Java object manipulation. `NEW` is used to create (construct) a Java object.
        nM> new java.lang.Double("10.12345678901234567") D
        nM> res d.getClass()
          O: D.GETCLASS()    = class java.lang.Double
  - `INVOKE` is used to call complex methods in a Java object.
        nM> new java.lang.String("a string with more") str
        nM> invoke ,,str.regionMatches(0,"a string",0,8)
        Invoke: ANSWER = true
`INVOKE` and `NEW` can be very powerful tools for evaluating and understanding how to use Java classes.
Java Experts Take Note:
NeXtMidas automatically converts the arguments for `INVOKE` and `NEW` from strings into objects. This creates a number of limitations: If multiple methods have the same name the "wrong" one may be called (e.g. `setFoo(int)` and `setFoo(String)` when given `2`) It is not possible to use a `null` since it is treated as the string `"null"`. It is difficult to call a method that takes in an object array.