0

I don't recognize this kind of form Java syntax for constructor - granted I do very little Java now (taken from there):

new PersistentArrayMap(new Object[]{formKey, form});

I was expecting something along the lines of new Object(...) as parameter. Could someone decompose the above line ?

nha
  • 17,623
  • 13
  • 87
  • 133

2 Answers2

2

You are creating new Object array Object[] initialised to {obj1, obj2}

diginoise
  • 7,352
  • 2
  • 31
  • 39
1

It is a way of declaring and initializing an array in java. A simpler example is the following:

int[] myIntArray = new int[]{1,2,3};
pleft
  • 7,567
  • 2
  • 21
  • 45