difference between new String[]{} and new String[] in java

arrays, java, string

Solution

`String array=new String[];` and `String array=new String[]{};` both are invalid statement in java.

It will gives you an error that you are trying to assign `String array` to `String` datatype. More specifically error is like this `Type mismatch: cannot convert from String[] to String`

Problem

I am fresher in java ,i have a doubt in java that is ``` String array= new String[]{}; ``` - what is the use of { } here ? - what is the difference between `String array=new String[];` and `String array=new String[]{};` - when I am writing `String array=new String[10]{};` got error why? Help me I am confused.

Original source