# java:new

Creates a Java object instance for use in java:call to invoke non-static methods.

Information noteImportant:

* You cannot assign the result of java:new to a variable. Use it directly in java:call.
* You cannot use java:new alone. java:new is only used as the first argument of a Java function call. For more information, see [Calling Java functions in expressions](https://help.qlik.com/talend/en-US/data-shaping-language-reference-guide/8.0/calling-java-functions "A Java function call is a call to a method of a Java class (static method) or a Java object that you can use directly in data shaping expressions using the java:call keyword.").

## Arguments

1. Class name (string).
2. Arguments of the constructor (any type).

## Examples

**Creating an object and calling a method:**

```
java:call(java:new("java.util.Random", 536815L), "nextInt", 100)
```

This example creates a Random object with a seed and calls its nextInt method.

**Creating an object with chained calls:**

```
java:call(java:call(java:new("java.text.SimpleDateFormat", "yyyy-MM-dd"), "parse", "2018-10-15"), "getDate")
```

This example creates a SimpleDateFormat object, parses a date string, and retrieves the date.