public class BubbleSort {
public static void sortiere(int[] x) {
boolean unsortiert=true;
int temp;
while (unsortiert){
unsortiert = false;
for (int i=0; i < x.length-1; i++)
if (x > x[i+1]) {
temp = x;
x = x[i+1];
x[i+1] = temp;
unsortiert = true;
}
}
}
public static void main(String[] args) {
int[] liste = {0,9,4,6,2,8,5,1,7,3};
sortiere(liste);
for (int i=0; i<liste.length; i++)
System.out.print(liste+" ");
}
}Der Originalquellcode. Habe nur rote X'e geändert, je nachdem was Eclipse vorgeschlagen hat. War aber bestimmt totaler murks. Mich wundert ja , dass keine Fehler angezeigt werden aber beim Ausführen dann dieser Fehler kommt: Exception in thread "main" java.lang.NullPointerException at BubbleSort.main(BubbleSort.java:23) (nicht beim orignialen Code sondern bei meinem Abgeänderten)