I have this code from Java project helper.
javaProject.setRawClasspath(new IClasspathEntry[0], null);
How new IClasspathEntry[0] works?

- How an interface is instantiated with new?
- How an array
[0]is used instead of parenthesis()with new?
ADDED
I think it’s a safer way of saying null.
No, an Interface can never be instantiated.
IClasspathEntry[0]is just an element of typeIClasspathEntry(well, asubtype of IClasspathEntry)at index zero in your array. you can’t instantiate an interface.The above just creates an array of type
IClasspathEntrywhich acceptssubtypes(class's which implement IClasspathEntry)elements.Sample Code :