3

Project[[ | ]] array = new Project[[1 | 1]];

I am not getting which kind of array declaration is this? Also I don't know if it is correct or not. I tried it in Netbeans but it is not allowed. But in this example http://wiki.netbeans.org/OpenProjectsProgramaticallyInNetBeansIDE I found such example.

Give me some idea if it is correct.

5
  • 3
    It's not correct syntax. Seems to be a typo in the example code. Commented Jul 31, 2013 at 9:37
  • 2
    Is this java ? ouch!!!!! when they changed the array syntax ? Commented Jul 31, 2013 at 9:38
  • Android Killer I am also surprised when i Saw this first time. Commented Jul 31, 2013 at 9:40
  • Doesn't seem to be correct syntax, even with the latest Java 8 conventions. I think it's just a typo, as Kayaman says. See here for documentation. Commented Jul 31, 2013 at 9:41
  • Project[] array = new Project[1]; is what they meant in that example. Commented Jul 31, 2013 at 10:04

2 Answers 2

2

According to javac from JDK7, it's invalid syntax (error: illegal start of expression pointing at the first [[). I assume it must be an error generating that page or some such.

Sign up to request clarification or add additional context in comments.

Comments

1

This is invalid syntax. See the Java Language Specification for the correct syntax for declaring an array. Specification.

The specification specifically states:

An array initializer is written as a comma-separated list of expressions, enclosed by braces { and }.

There is no mention of adding pipes or nesting brackets.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.