I'm new to Java so this might be a dumb question. Say I create a class called SomeObject with simple getters and setters for some parameter. Next I want to create an array of 3 instances of that object. Can anyone tell me what's the difference between:

```
SomeObject[] objectArray = {new SomeObject(),new SomeObject(),new SomeObject()};
objectArray[0].setValue(10);

```

and:

```
SomeObject[] objectArray = new SomeObject[3];
objectArray[0].setValue(10);

```

In the first case I can perfectly well get the value of objects[0]:

```
System.out.println(objectArray[0].getValue());

```

..while the latter gives a NullPointerException while trying to set the value. Am I missing something or could it be I made some mistake of a different kind?