J
JaiWhite
Gast
heyy,
ich versuche mich gerade an einem algorithmus...bekomme andauernd eine NullPointExeption..
kann mir jemand helfen ??
ich versuche mich gerade an einem algorithmus...bekomme andauernd eine NullPointExeption..
kann mir jemand helfen ??
Java:
static int[] r;
static void aa(int n, int k) {
int[] a ={1,2,3,4,5,6};
for (int j= k - 1; j <= n-1;j++) {
for(int i = j - k + 1; i <= j; i++){
r[j]=r[j]+a[i]; //NULLPOINTEXEPTION
}
r[j]=r[j]/k ;
}
for (int b = 0 ; b < r.length; b++) {
System.out.print(r[b]);
}
}