';' expected - Java -
04-06-2004
I know there arent many java coders in here, but I hope someone can help my anyway.
The compiler gives me this error with a "^" below the last bracket:
';' expected
stats_sum = styrke + intelligens + liv.liv()/10);
This is how the lines around look like:
//Tjek om stats er fair
public void stats()
{
double stats_sum;
stats_sum = styrke + intelligens + liv.liv()/10);
if(stats_sum!=30)
{
System.out.println("");
System.out.println("Intern programfejl - Stats for racen "
+ race + " er ikke fair");
System.out.println("");
}
}
The liv object gets initialized here:
//Liv
//Opret et objekt af klassen Liv
Liv liv = new Liv();
The liv method/function is here:
//Justerer eller returnerer spillerens liv
public int liv(int a)
{
if(a!=0)
{
//Giver spilleren a mere i liv, hvis a ikke er 0
liv = liv + a;
System.out.println("Du har nu " + liv + " i liv");
}
else
{
//Returnerer værdien af liv til den kaldende funktion
return liv;
}
}
Last edited by Zacker; 04-06-2004 at 17:52..
|