[Solved] What is the difference between “String[] s” and “String s[]”? [duplicate]


There are a few ways to interpret your question,

// this was missing a size. So we need to add one.
int x = 10;
String []s = new String[x];
String s[] = new String[x]; // This is the same as the previous line.

The other form type of question is this,

//These are two null arrays.
String s[];
String []s;

So you can put the brackets before (or after) the array name in Java. That is a convenience the compiler offers, they’re equivalent.

solved What is the difference between “String[] s” and “String s[]”? [duplicate]