Hallo zusammen
ich hab nur kurz eine Frage.
Wenn ich mein Programm ausführen möchte, dann kommt folgender Fehler:
Could not find the main class. Program will exit!
Kann mir jemand weiterhelfen?
Ach ja, hier ist noch der Code:
ich hab nur kurz eine Frage.
Wenn ich mein Programm ausführen möchte, dann kommt folgender Fehler:
Could not find the main class. Program will exit!
Kann mir jemand weiterhelfen?
Ach ja, hier ist noch der Code:
Code:
package aufgabe4;
class bla_BackTrack
{
public static void main (String[] args)
{
int actTime = 0;
findBestPath('x', actTime);
System.out.println(bestTime);
}
static int x=0;
static int y=0;
static int bestTime=0;
static char[][] Lab = {{'A','5','4','7','X'},
{'1','9','5','X','2'},
{'X','4','6','7','9'},
{'1','X','9','1','1'},
{'7','9','3','7','E'}};
public static boolean findBestPath(char compass, int actTime)
{
switch(compass)
{
case 'x': break;
case 'r': if((x+1 <= 4) && (Lab[x+1][y] !='X'))
{
Lab[x][y] = 'X'; x++; actTime += (int)(Lab[x][y]);
}
else
{
return (false);
}
break;
case 'u': if((y+1) <= 4 && Lab[x][y+1] !='X')
{
Lab[x][y] = 'X'; y++; actTime += (int)(Lab[x][y]);
}
else
{
return (false);
}
break;
case 'l': if((x-1) <= 4 && Lab[x-1][y] !='X')
{
Lab[x][y] = 'X'; x--; actTime += (int)(Lab[x][y]);
}
else
{
return (false);
}
break;
case 'o': if((y-1) <= 4 && Lab[x][y-1] !='X')
{
Lab[x][y] = 'X'; y--; actTime += (int)(Lab[x][y]);
}
else
{
return (false);
}
break;
default: return (false);
}
if(Lab[x][y] == 'E')
{
if(actTime > bestTime)
{
bestTime = actTime;
}
return (false);
}
if(findBestPath('r', actTime)){ }
if(findBestPath('u', actTime)){ }
if(findBestPath('l', actTime)){ }
if(findBestPath('o', actTime)){ }
System.out.println(actTime);
return (false);
}
}