This might be a trivial question, but I came across this syntax for an Array Declaration:
void someFunction(int n){
int[] myArray = new int[ n == 0 ? 1 : n ];
...
}
I tried looking up online for some tutorials to understand what is happening with no luck.
Can anyone explain the expression in the right bracket, and when is something like that typically used?

n == 0 ? 1 : nis basically a compressed if statement, if the condition is true, it's the first element, if it's the not then it's the second element. In this case the variable seems to be the array size, and the code makes sure the array is never of size zero.