How to define a variable-length integer array in java and why not: int a[ 10] = {1, 2,3}; But in c++?
Java and c++ are two different languages, and c++ may or may not be Java.
You can use
int[]a = new int[ 10];
a[0]= 1;
a[ 1]= 2;
a[2]= 3;
Initialization and assignment