it's +=
, not =+
What you do could be valid code as well, but right now you're doing
avg[0] = + array0[i];
It will work for numeric types (which I assume you have). Simplified example without array index:
int x = +5;
Sample:
public static void main(String[] args) {
int x = -5;
int y = +x;
System.out.println(y); // - + => -
int a = 5;
int b = -a;
System.out.println(b); // + - => -
int c = 5;
int d = +5;
System.out.println(d); // + + => +
int m = -5;
int n = -m;
System.out.println(n); // - - => +
}
Output:
-5
-5
5
5
Copied from comments for clarity:
You're basically saying x = + y
. In this case the +
is just a matter of indicating it's a positive integer. It's valid code, but it's not what you intend.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…