I'm trying to calculate the average of numbers in the array. Unlike Python, the following does not work for me:
[not working](https://i.stack.imgur.com/9ly57.png)

However, if I do [this](https://i.stack.imgur.com/umshk.png) everything is okay.

Is there a way to make it work like in Python? Without allocate a variable to the input-array?

My code:

```
public class TestTwo {

    public static void main(String[] args) {
        double[] arx = {1,2.0,4,5,6,7.0};
        System.out.println(average(arx));
    }

    public static double average(double [] args) {
        double sum = 0.0;
        for (double d : args) {
            sum += d;
        }
        return sum / args.length;
    }   
}

```