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;
}
MusicMan, nope the capital is not needed. I define the Liv class to be liv here:
Liv liv = new Liv();
1. word is variable type
2. word is variable name
3. word is for a new object
4. word is class name
yeah downside about the compiler is it's not very accurate as to giving u whats exactly wrong....but basically the error is somewhere on that line...or rarely else where in code that calls the line
what is it ur trying to do with that code if u don't mind me asking