I don’t know if the second for-loop would be considered a statement to mean that the curly braces are needed.
So what I am asking is would these for-loops:
for (int i=1;i<a.length;i++){
for (int j=0;j<a[i].length;j++){
a[i][j] = b[i][j]-c[i][j];
}
}
mean the same thing as these for-loops:
for (int i=1;i<a.length;i++)
for (int j=0;j<a[i].length;j++)
a[i][j] = b[i][j]-c[i][j];
Short answer: No
Long answer: You don’t have to but you should. It increases code readability, it can save you from useless debugging and late night hours. Also, Oracle’s code conventions clearly states that you should always use braces.
You can write this too: