Skip to content

Questions about array literals #27

@stargazerZJ

Description

@stargazerZJ

Which is legal, new int[] { {1, 2}, {} } or new int[][] { {1, 2}, {} }?
Is this legal? new int[3] {1, 2, 3, 4}
What about new int[] { 1, 2, (3), (4) }" ?
What about new int[] {1 + 2, 3 + 4} ?
What about this new int[a] {1, 2, 3, 4} and a is obtained at runtime?
To be sure, new MyType[][] { {}, {}, {} } is not legal, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions