G
Guest
Gast
Hallo, ich habe ein Programm geschrieben, dass ein zufällig erzeugtes Array aufsteigend sortieren soll. Das Compilieren funktioniert problemlos, aber beim Ausführen erhalte ich die Fehlermeldung:
Exception in thread "main" java.langNoSuchMethodError: main
woran kann das liegen?
das is das Programm:
Exception in thread "main" java.langNoSuchMethodError: main
woran kann das liegen?
das is das Programm:
Code:
public class sortiere
{
public void main(String[] args)
{
int[] sortme = new int[10];
for (int i=0 ; i < sortme.length ; i++ )
sortme[i] = (int) (Math.random()*100+1);
for (int i = 0 ; i < sortme.length ; i++ ){
System.out.print(sortme[i] + " ");
}
for (int i=0 ; i < sortme.length ; i++ ){
System.out.print(machjetzt(sortme)[i] + " ");
}
}
boolean binichsortiert(int[] a){
for (int i=0 ; i < a.length-1 ; i++){
if (a[i] > a[i+1]){
return false;
}
}
return true;
}
int[] sortiere(int[] b){
int rand1 = (int) (Math.random()*(b.length+1));
int rand2 = (int) (Math.random()*(b.length+1));
int temp1 = b[rand2];
if (rand1 >= rand2){
if (b[rand1] < b[rand2]){
b[rand2]=b[rand1];
b[rand1]=temp1;
}
}
if (rand1 < rand2){
if (b[rand2] < b[rand1]){
b[rand2]=b[rand1];
b[rand1]=temp1;
}
}
return b;
}
int[] machjetzt(int[] c){
while(binichsortiert(c)==false) sortiere(c);
return c;
}
}